Skip to content

Commit

Permalink
#2141 fix travis (#1255)
Browse files Browse the repository at this point in the history
* test build

* remove fabric

* remove jupyter

* fix errors

* updated travis file to include jupyter and install python-dev

* attempt to fix install of jupyter, with dep on scandir

* include sources

* fix unittest tests

* revert change

* include py3 into tests

* moved to separate dir

* remove unwanted files

* fixed tests and removed hacky approach to setting pythonpath

* enabled python 3.6

* use oxs

* disable osx tests

* renamed files to remove unnecessary prefixes

* disable checking results of installer on travis

* renamed to remove unnecessary prefixes

* log test output

* removed debug code

* lots of logging to identify errors in python 2.7 on travis

* clean up jupyter tests

* aditional logging

* ignore last filed files

* ignore files

* renamed

* uncommented files

* fix unit tests (to run on travis and locally)

* ignore noseids

* remove virtualenv and remove sudo requirement

* added cache:pip  and removed sudo requirements

* code review updates
  • Loading branch information
DonJayamanne authored Oct 3, 2017
1 parent 9c7a8e3 commit ba2ccab
Show file tree
Hide file tree
Showing 38 changed files with 630 additions and 937 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ out
node_modules
*.pyc
.vscode/.ropeproject/**
src/test/.vscode/tags
src/test/.vscode/**
**/testFiles/**/.cache/**
*.noseids
55 changes: 25 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
language: python
sudo: required
dist: trusty
cache: pip

addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- g++-4.9
- gcc-4.9-multilib
- g++-4.9-multilib
- libgtk2.0-0
- libx11-dev
- libxkbfile-dev
- libsecret-1-dev
- python-dev
matrix:
include:
# # Use the built in venv for linux builds
- os: linux
sudo: required
python: 2.7
- os: linux
sudo: required
python: 3.5
python: 3.6
# # # Use generic language for osx
# - os: osx
# language: generic
# env: PYTHON=2.7.10
# # Use generic language for osx
- os: osx
language: generic
env: PYTHON=2.7.10
# Use generic language for osx
- os: osx
language: generic
env: PYTHON=3.5.1
# Perform the manual steps on osx to install python3 and activate venv
# - os: osx
# language: generic
# env: PYTHON=3.6.1
# Perform the manual steps on osx to install python 2.7.1 and 3.6.1 and set it as the global interpreter.
# This way when the node unit tests will pick the right version of python (from global)
before_install: |
if [ $TRAVIS_OS_NAME == "linux" ]; then
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
Expand All @@ -37,26 +45,13 @@ before_install: |
nvm use 7.2.1
npm config set python `which python`
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
brew update;
brew install openssl readline
brew outdated pyenv || brew upgrade pyenv
brew install pyenv-virtualenv
brew install pyenv-virtualenvwrapper
pyenv install $PYTHON
pyenv virtualenv $PYTHON MYVERSION
source ~/.pyenv/versions/MYVERSION/bin/activate
python --version
python -c 'import sys;print(sys.version)'
python -c 'import sys;print(sys.executable)'
pyenv install $PYTHON
pyenv global $PYTHON
fi
install:
# we have this here so we can see where python is installed and hardcode in our tests
# else when running npm test, the python version picked is completely different :(
- python --version
- python -c 'import sys;print(sys.executable)'
- pip install -r requirements.txt
- pip install --upgrade -r requirements.txt
- npm install
- npm run vscode:prepublish

script:
- npm test --silent
- npm test --silent
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ jupyter
ipython
nose
pytest
#fabric
numba
fabric
numba
3 changes: 0 additions & 3 deletions src/test/.vscode/xsettings.jsons

This file was deleted.

23 changes: 7 additions & 16 deletions src/test/autocomplete/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Please refer to their documentation on https://mochajs.org/ for help.


// Place this right on top
import { initialize, PYTHON_PATH, closeActiveWindows, setPythonExecutable } from '../initialize';
// The module 'assert' provides assertion methods from node
import * as assert from 'assert';
import { EOL } from 'os';
Expand All @@ -12,12 +10,11 @@ import { EOL } from 'os';
import * as vscode from 'vscode';
import * as path from 'path';
import * as settings from '../../client/common/configSettings';
import { initialize, closeActiveWindows } from '../initialize';
import { execPythonFile } from '../../client/common/utils';
import { createDeferred } from '../../client/common/helpers';

let pythonSettings = settings.PythonSettings.getInstance();
let disposable: vscode.Disposable;
let autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
const pythonSettings = settings.PythonSettings.getInstance();
const autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
const fileOne = path.join(autoCompPath, 'one.py');
const fileImport = path.join(autoCompPath, 'imp.py');
const fileDoc = path.join(autoCompPath, 'doc.py');
Expand All @@ -27,21 +24,15 @@ const fileEncoding = path.join(autoCompPath, 'four.py');
const fileEncodingUsed = path.join(autoCompPath, 'five.py');

suite('Autocomplete', () => {
const isPython3Deferred = createDeferred<boolean>();
const isPython3 = isPython3Deferred.promise;
let isPython3: Promise<boolean>;
suiteSetup(async () => {
disposable = setPythonExecutable(pythonSettings);
await initialize();
let version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
isPython3Deferred.resolve(version.indexOf('3.') >= 0);
isPython3 = Promise.resolve(version.indexOf('3.') >= 0);
});

suiteTeardown(done => {
closeActiveWindows().then(done, done);
});
teardown(done => {
closeActiveWindows().then(done, done);
});
suiteTeardown(() => closeActiveWindows());
teardown(() => closeActiveWindows());

test('For "sys."', done => {
let textEditor: vscode.TextEditor;
Expand Down
29 changes: 9 additions & 20 deletions src/test/autocomplete/pep484.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// Please refer to their documentation on https://mochajs.org/ for help.


// Place this right on top
import { initialize, closeActiveWindows, setPythonExecutable } from '../initialize';
// The module 'assert' provides assertion methods from node
import * as assert from 'assert';
// You can import and use all API from the 'vscode' module
Expand All @@ -13,30 +11,21 @@ import * as vscode from 'vscode';
import * as path from 'path';
import * as settings from '../../client/common/configSettings';
import { execPythonFile } from '../../client/common/utils';
import { createDeferred } from '../../client/common/helpers';
import { initialize, closeActiveWindows } from '../initialize';

let pythonSettings = settings.PythonSettings.getInstance();
let disposable: vscode.Disposable;

let autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
const pythonSettings = settings.PythonSettings.getInstance();
const autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
const filePep484 = path.join(autoCompPath, 'pep484.py');

suite('Autocomplete PEP 484', () => {
const isPython3Deferred = createDeferred<boolean>();
const isPython3 = isPython3Deferred.promise;
let isPython3: Promise<boolean>;
suiteSetup(async () => {
disposable = setPythonExecutable(pythonSettings);
await initialize();
let version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
isPython3Deferred.resolve(version.indexOf('3.') >= 0);
});
suiteTeardown(done => {
disposable.dispose();
closeActiveWindows().then(() => done(), () => done());
});
teardown(done => {
closeActiveWindows().then(() => done(), () => done());
const version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
isPython3 = Promise.resolve(version.indexOf('3.') >= 0);
});
suiteTeardown(() => closeActiveWindows());
teardown(() => closeActiveWindows());

test('argument', async () => {
if (!await isPython3) {
Expand Down Expand Up @@ -64,4 +53,4 @@ suite('Autocomplete PEP 484', () => {
assert.notEqual(list.items.filter(item => item.label === 'bit_length').length, 0, 'bit_length not found');
assert.notEqual(list.items.filter(item => item.label === 'from_bytes').length, 0, 'from_bytes not found');
});
});
});
29 changes: 9 additions & 20 deletions src/test/autocomplete/pep526.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// Please refer to their documentation on https://mochajs.org/ for help.


// Place this right on top
import { initialize, closeActiveWindows, setPythonExecutable } from '../initialize';
// The module 'assert' provides assertion methods from node
import * as assert from 'assert';
// You can import and use all API from the 'vscode' module
Expand All @@ -13,30 +11,21 @@ import * as vscode from 'vscode';
import * as path from 'path';
import * as settings from '../../client/common/configSettings';
import { execPythonFile } from '../../client/common/utils';
import { createDeferred } from '../../client/common/helpers';
import { initialize, closeActiveWindows } from '../initialize';

let pythonSettings = settings.PythonSettings.getInstance();
let disposable: vscode.Disposable;

let autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
const pythonSettings = settings.PythonSettings.getInstance();
const autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
const filePep526 = path.join(autoCompPath, 'pep526.py');

suite('Autocomplete PEP 526', () => {
const isPython3Deferred = createDeferred<boolean>();
const isPython3 = isPython3Deferred.promise;
let isPython3: Promise<boolean>;
suiteSetup(async () => {
disposable = setPythonExecutable(pythonSettings);
await initialize();
let version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
isPython3Deferred.resolve(version.indexOf('3.') >= 0);
});
suiteTeardown(done => {
disposable.dispose();
closeActiveWindows().then(() => done(), () => done());
});
teardown(done => {
closeActiveWindows().then(() => done(), () => done());
const version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
isPython3 = Promise.resolve(version.indexOf('3.') >= 0);
});
suiteTeardown(() => closeActiveWindows());
teardown(() => closeActiveWindows());

test('variable (abc:str)', async () => {
if (!await isPython3) {
Expand Down Expand Up @@ -107,4 +96,4 @@ suite('Autocomplete PEP 526', () => {
const list = await vscode.commands.executeCommand<vscode.CompletionList>('vscode.executeCompletionItemProvider', textDocument.uri, position);
assert.notEqual(list.items.filter(item => item.label === 'bit_length').length, 0, 'bit_length not found');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@
// Please refer to their documentation on https://mochajs.org/ for help.
//

// Place this right on top
import { initialize } from './../initialize';
// The module 'assert' provides assertion methods from node
import * as assert from 'assert';
import * as vscode from 'vscode';

// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import { initialize } from './../initialize';
import { execPythonFile } from '../../client/common/utils';
import { EOL } from 'os';
import { createDeferred } from '../../client/common/helpers';
import * as vscode from 'vscode';

// Defines a Mocha test suite to group tests of similar kind together
suite('ChildProc', () => {
setup(done => {
initialize().then(() => done(), done);
});
setup(() => initialize());
test('Standard Response', done => {
execPythonFile('python', ['-c', 'print(1)'], __dirname, false).then(data => {
assert.ok(data === '1' + EOL);
Expand Down Expand Up @@ -78,4 +75,4 @@ suite('ChildProc', () => {

def.promise.then(done).catch(done);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,22 @@
// Please refer to their documentation on https://mochajs.org/ for help.
//

// Place this right on top
import { initialize, IS_TRAVIS } from './../initialize';
// The module 'assert' provides assertion methods from node
import * as assert from 'assert';

// You can import and use all API from the 'vscode' module
// as well as import your extension to test it
import * as vscode from 'vscode';
import { initialize, IS_TRAVIS } from './../initialize';
import { PythonSettings } from '../../client/common/configSettings';
import { SystemVariables } from '../../client/common/systemVariables';

const pythonSettings = PythonSettings.getInstance();

// Defines a Mocha test suite to group tests of similar kind together
suite('Configuration Settings', () => {
setup(done => {
initialize().then(() => done(), done);
});
setup(() => initialize());

if (!IS_TRAVIS) {
test('Check Values', done => {
const systemVariables: SystemVariables = new SystemVariables();
Expand All @@ -39,4 +37,4 @@ suite('Configuration Settings', () => {
done();
});
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ suite('Deferred', () => {

done();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ suite('IdDispenser', () => {

done();
});
});
});
Loading

0 comments on commit ba2ccab

Please sign in to comment.