Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ba2ccab

Browse files
authored
#2141 fix travis (DonJayamanne#1255)
* 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
1 parent 9c7a8e3 commit ba2ccab

38 files changed

+630
-937
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ out
33
node_modules
44
*.pyc
55
.vscode/.ropeproject/**
6-
src/test/.vscode/tags
6+
src/test/.vscode/**
7+
**/testFiles/**/.cache/**
8+
*.noseids

.travis.yml

+25-30
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,37 @@
11
language: python
2-
sudo: required
3-
dist: trusty
2+
cache: pip
43

54
addons:
65
apt:
6+
sources:
7+
- ubuntu-toolchain-r-test
78
packages:
9+
- gcc-4.9
10+
- g++-4.9
11+
- gcc-4.9-multilib
12+
- g++-4.9-multilib
13+
- libgtk2.0-0
14+
- libx11-dev
15+
- libxkbfile-dev
816
- libsecret-1-dev
17+
- python-dev
918
matrix:
1019
include:
1120
# # Use the built in venv for linux builds
1221
- os: linux
13-
sudo: required
1422
python: 2.7
1523
- os: linux
16-
sudo: required
17-
python: 3.5
24+
python: 3.6
25+
# # # Use generic language for osx
26+
# - os: osx
27+
# language: generic
28+
# env: PYTHON=2.7.10
1829
# # Use generic language for osx
19-
- os: osx
20-
language: generic
21-
env: PYTHON=2.7.10
22-
# Use generic language for osx
23-
- os: osx
24-
language: generic
25-
env: PYTHON=3.5.1
26-
# Perform the manual steps on osx to install python3 and activate venv
30+
# - os: osx
31+
# language: generic
32+
# env: PYTHON=3.6.1
33+
# Perform the manual steps on osx to install python 2.7.1 and 3.6.1 and set it as the global interpreter.
34+
# This way when the node unit tests will pick the right version of python (from global)
2735
before_install: |
2836
if [ $TRAVIS_OS_NAME == "linux" ]; then
2937
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
@@ -37,26 +45,13 @@ before_install: |
3745
nvm use 7.2.1
3846
npm config set python `which python`
3947
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
40-
brew update;
41-
brew install openssl readline
42-
brew outdated pyenv || brew upgrade pyenv
43-
brew install pyenv-virtualenv
44-
brew install pyenv-virtualenvwrapper
45-
pyenv install $PYTHON
46-
pyenv virtualenv $PYTHON MYVERSION
47-
source ~/.pyenv/versions/MYVERSION/bin/activate
48-
python --version
49-
python -c 'import sys;print(sys.version)'
50-
python -c 'import sys;print(sys.executable)'
48+
pyenv install $PYTHON
49+
pyenv global $PYTHON
5150
fi
5251
install:
53-
# we have this here so we can see where python is installed and hardcode in our tests
54-
# else when running npm test, the python version picked is completely different :(
55-
- python --version
56-
- python -c 'import sys;print(sys.executable)'
57-
- pip install -r requirements.txt
52+
- pip install --upgrade -r requirements.txt
5853
- npm install
5954
- npm run vscode:prepublish
6055

6156
script:
62-
- npm test --silent
57+
- npm test --silent

requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ jupyter
99
ipython
1010
nose
1111
pytest
12-
#fabric
13-
numba
12+
fabric
13+
numba

src/test/.vscode/xsettings.jsons

-3
This file was deleted.

src/test/autocomplete/base.test.ts

+7-16
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Please refer to their documentation on https://mochajs.org/ for help.
33

44

5-
// Place this right on top
6-
import { initialize, PYTHON_PATH, closeActiveWindows, setPythonExecutable } from '../initialize';
75
// The module 'assert' provides assertion methods from node
86
import * as assert from 'assert';
97
import { EOL } from 'os';
@@ -12,12 +10,11 @@ import { EOL } from 'os';
1210
import * as vscode from 'vscode';
1311
import * as path from 'path';
1412
import * as settings from '../../client/common/configSettings';
13+
import { initialize, closeActiveWindows } from '../initialize';
1514
import { execPythonFile } from '../../client/common/utils';
16-
import { createDeferred } from '../../client/common/helpers';
1715

18-
let pythonSettings = settings.PythonSettings.getInstance();
19-
let disposable: vscode.Disposable;
20-
let autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
16+
const pythonSettings = settings.PythonSettings.getInstance();
17+
const autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
2118
const fileOne = path.join(autoCompPath, 'one.py');
2219
const fileImport = path.join(autoCompPath, 'imp.py');
2320
const fileDoc = path.join(autoCompPath, 'doc.py');
@@ -27,21 +24,15 @@ const fileEncoding = path.join(autoCompPath, 'four.py');
2724
const fileEncodingUsed = path.join(autoCompPath, 'five.py');
2825

2926
suite('Autocomplete', () => {
30-
const isPython3Deferred = createDeferred<boolean>();
31-
const isPython3 = isPython3Deferred.promise;
27+
let isPython3: Promise<boolean>;
3228
suiteSetup(async () => {
33-
disposable = setPythonExecutable(pythonSettings);
3429
await initialize();
3530
let version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
36-
isPython3Deferred.resolve(version.indexOf('3.') >= 0);
31+
isPython3 = Promise.resolve(version.indexOf('3.') >= 0);
3732
});
3833

39-
suiteTeardown(done => {
40-
closeActiveWindows().then(done, done);
41-
});
42-
teardown(done => {
43-
closeActiveWindows().then(done, done);
44-
});
34+
suiteTeardown(() => closeActiveWindows());
35+
teardown(() => closeActiveWindows());
4536

4637
test('For "sys."', done => {
4738
let textEditor: vscode.TextEditor;

src/test/autocomplete/pep484.test.ts

+9-20
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// Please refer to their documentation on https://mochajs.org/ for help.
44

55

6-
// Place this right on top
7-
import { initialize, closeActiveWindows, setPythonExecutable } from '../initialize';
86
// The module 'assert' provides assertion methods from node
97
import * as assert from 'assert';
108
// You can import and use all API from the 'vscode' module
@@ -13,30 +11,21 @@ import * as vscode from 'vscode';
1311
import * as path from 'path';
1412
import * as settings from '../../client/common/configSettings';
1513
import { execPythonFile } from '../../client/common/utils';
16-
import { createDeferred } from '../../client/common/helpers';
14+
import { initialize, closeActiveWindows } from '../initialize';
1715

18-
let pythonSettings = settings.PythonSettings.getInstance();
19-
let disposable: vscode.Disposable;
20-
21-
let autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
16+
const pythonSettings = settings.PythonSettings.getInstance();
17+
const autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
2218
const filePep484 = path.join(autoCompPath, 'pep484.py');
2319

2420
suite('Autocomplete PEP 484', () => {
25-
const isPython3Deferred = createDeferred<boolean>();
26-
const isPython3 = isPython3Deferred.promise;
21+
let isPython3: Promise<boolean>;
2722
suiteSetup(async () => {
28-
disposable = setPythonExecutable(pythonSettings);
2923
await initialize();
30-
let version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
31-
isPython3Deferred.resolve(version.indexOf('3.') >= 0);
32-
});
33-
suiteTeardown(done => {
34-
disposable.dispose();
35-
closeActiveWindows().then(() => done(), () => done());
36-
});
37-
teardown(done => {
38-
closeActiveWindows().then(() => done(), () => done());
24+
const version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
25+
isPython3 = Promise.resolve(version.indexOf('3.') >= 0);
3926
});
27+
suiteTeardown(() => closeActiveWindows());
28+
teardown(() => closeActiveWindows());
4029

4130
test('argument', async () => {
4231
if (!await isPython3) {
@@ -64,4 +53,4 @@ suite('Autocomplete PEP 484', () => {
6453
assert.notEqual(list.items.filter(item => item.label === 'bit_length').length, 0, 'bit_length not found');
6554
assert.notEqual(list.items.filter(item => item.label === 'from_bytes').length, 0, 'from_bytes not found');
6655
});
67-
});
56+
});

src/test/autocomplete/pep526.test.ts

+9-20
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// Please refer to their documentation on https://mochajs.org/ for help.
44

55

6-
// Place this right on top
7-
import { initialize, closeActiveWindows, setPythonExecutable } from '../initialize';
86
// The module 'assert' provides assertion methods from node
97
import * as assert from 'assert';
108
// You can import and use all API from the 'vscode' module
@@ -13,30 +11,21 @@ import * as vscode from 'vscode';
1311
import * as path from 'path';
1412
import * as settings from '../../client/common/configSettings';
1513
import { execPythonFile } from '../../client/common/utils';
16-
import { createDeferred } from '../../client/common/helpers';
14+
import { initialize, closeActiveWindows } from '../initialize';
1715

18-
let pythonSettings = settings.PythonSettings.getInstance();
19-
let disposable: vscode.Disposable;
20-
21-
let autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
16+
const pythonSettings = settings.PythonSettings.getInstance();
17+
const autoCompPath = path.join(__dirname, '..', '..', '..', 'src', 'test', 'pythonFiles', 'autocomp');
2218
const filePep526 = path.join(autoCompPath, 'pep526.py');
2319

2420
suite('Autocomplete PEP 526', () => {
25-
const isPython3Deferred = createDeferred<boolean>();
26-
const isPython3 = isPython3Deferred.promise;
21+
let isPython3: Promise<boolean>;
2722
suiteSetup(async () => {
28-
disposable = setPythonExecutable(pythonSettings);
2923
await initialize();
30-
let version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
31-
isPython3Deferred.resolve(version.indexOf('3.') >= 0);
32-
});
33-
suiteTeardown(done => {
34-
disposable.dispose();
35-
closeActiveWindows().then(() => done(), () => done());
36-
});
37-
teardown(done => {
38-
closeActiveWindows().then(() => done(), () => done());
24+
const version = await execPythonFile(pythonSettings.pythonPath, ['--version'], __dirname, true);
25+
isPython3 = Promise.resolve(version.indexOf('3.') >= 0);
3926
});
27+
suiteTeardown(() => closeActiveWindows());
28+
teardown(() => closeActiveWindows());
4029

4130
test('variable (abc:str)', async () => {
4231
if (!await isPython3) {
@@ -107,4 +96,4 @@ suite('Autocomplete PEP 526', () => {
10796
const list = await vscode.commands.executeCommand<vscode.CompletionList>('vscode.executeCompletionItemProvider', textDocument.uri, position);
10897
assert.notEqual(list.items.filter(item => item.label === 'bit_length').length, 0, 'bit_length not found');
10998
});
110-
});
99+
});

src/test/common/extension.common.test.ts renamed to src/test/common/common.test.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,20 @@
33
// Please refer to their documentation on https://mochajs.org/ for help.
44
//
55

6-
// Place this right on top
7-
import { initialize } from './../initialize';
86
// The module 'assert' provides assertion methods from node
97
import * as assert from 'assert';
8+
import * as vscode from 'vscode';
109

1110
// You can import and use all API from the 'vscode' module
1211
// as well as import your extension to test it
12+
import { initialize } from './../initialize';
1313
import { execPythonFile } from '../../client/common/utils';
1414
import { EOL } from 'os';
1515
import { createDeferred } from '../../client/common/helpers';
16-
import * as vscode from 'vscode';
1716

1817
// Defines a Mocha test suite to group tests of similar kind together
1918
suite('ChildProc', () => {
20-
setup(done => {
21-
initialize().then(() => done(), done);
22-
});
19+
setup(() => initialize());
2320
test('Standard Response', done => {
2421
execPythonFile('python', ['-c', 'print(1)'], __dirname, false).then(data => {
2522
assert.ok(data === '1' + EOL);
@@ -78,4 +75,4 @@ suite('ChildProc', () => {
7875

7976
def.promise.then(done).catch(done);
8077
});
81-
});
78+
});

src/test/common/extension.common.configSettings.test.ts renamed to src/test/common/configSettings.test.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,22 @@
33
// Please refer to their documentation on https://mochajs.org/ for help.
44
//
55

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

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

1716
const pythonSettings = PythonSettings.getInstance();
1817

1918
// Defines a Mocha test suite to group tests of similar kind together
2019
suite('Configuration Settings', () => {
21-
setup(done => {
22-
initialize().then(() => done(), done);
23-
});
20+
setup(() => initialize());
21+
2422
if (!IS_TRAVIS) {
2523
test('Check Values', done => {
2624
const systemVariables: SystemVariables = new SystemVariables();
@@ -39,4 +37,4 @@ suite('Configuration Settings', () => {
3937
done();
4038
});
4139
}
42-
});
40+
});

src/test/common/extension.common.helpers.test.ts renamed to src/test/common/helpers.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ suite('Deferred', () => {
6565

6666
done();
6767
});
68-
});
68+
});

src/test/common/extension.common.idDispenser.test.ts renamed to src/test/common/idDispenser.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ suite('IdDispenser', () => {
4747

4848
done();
4949
});
50-
});
50+
});

0 commit comments

Comments
 (0)