Skip to content

Commit

Permalink
test: direct python invocation & simpler pyenv
Browse files Browse the repository at this point in the history
Reorder Travis builds by OS. Replace `pyenv global` calls with
properly set `PATH` and `PYENV_VERSION` env vars. Does not
assume python modules are in the `PATH` so all python
modules are prefixed with `python -m`.

PR-URL: #1979
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
imatlopez authored and rvagg committed Dec 15, 2019
1 parent d6a7e0e commit 345c70e
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,6 @@ jobs:
- name: "Python 2.7 on Linux"
env: NODE_GYP_FORCE_PYTHON=python2
python: 2.7
- name: "Python 2.7 on macOS"
os: osx
osx_image: xcode11.2
language: shell # 'language: python' is not yet supported on macOS
env: NODE_GYP_FORCE_PYTHON=python2
before_install:
- pyenv install 2.7
- pyenv global 2.7
- name: "Node.js 6 & Python 2.7 on Windows"
os: windows
language: node_js
node_js: 6 # node
env: >-
PATH=/c/Python27:/c/Python27/Scripts:$PATH
NODE_GYP_FORCE_PYTHON=/c/Python27/python.exe
before_install: choco install python2
- name: "Node.js 12 & Python 2.7 on Windows"
os: windows
language: node_js
node_js: 12 # node
env: >-
PATH=/c/Python27:/c/Python27/Scripts:$PATH
NODE_GYP_FORCE_PYTHON=/c/Python27/python.exe
before_install: choco install python2

- name: "Node.js 6 & Python 3.8 on Linux"
python: 3.8
Expand Down Expand Up @@ -67,11 +43,36 @@ jobs:
env: NODE_GYP_FORCE_PYTHON=python3
before_install: nvm install 12

- name: "Python 3.7 on macOS"
- name: "Python 2.7 on macOS"
os: osx
osx_image: xcode11.2
language: shell # 'language: python' is not yet supported on macOS
env: NODE_GYP_FORCE_PYTHON=python3
env: NODE_GYP_FORCE_PYTHON=python2 PATH=$HOME/.pyenv/shims:$PATH PYENV_VERSION=2.7.17
before_install: pyenv install $PYENV_VERSION
- name: "Python 3.8 on macOS"
os: osx
osx_image: xcode11.2
language: shell # 'language: python' is not yet supported on macOS
env: NODE_GYP_FORCE_PYTHON=python3 PATH=$HOME/.pyenv/shims:$PATH PYENV_VERSION=3.8.0
before_install: pyenv install $PYENV_VERSION

- name: "Node.js 6 & Python 2.7 on Windows"
os: windows
language: node_js
node_js: 6 # node
env: >-
PATH=/c/Python27:/c/Python27/Scripts:$PATH
NODE_GYP_FORCE_PYTHON=/c/Python27/python.exe
before_install: choco install python2
- name: "Node.js 12 & Python 2.7 on Windows"
os: windows
language: node_js
node_js: 12 # node
env: >-
PATH=/c/Python27:/c/Python27/Scripts:$PATH
NODE_GYP_FORCE_PYTHON=/c/Python27/python.exe
before_install: choco install python2

- name: "Node.js 12 & Python 3.7 on Windows"
os: windows
language: node_js
Expand All @@ -90,20 +91,19 @@ jobs:
before_install: choco install python

install:
#- pip install -r requirements.txt
- pip install --upgrade flake8 pytest==4.6.6 # pytest 5 no longer supports legacy Python
- python -m pip install --upgrade flake8 pytest==4.6.6 # pytest 5 no longer supports legacy Python
before_script:
- flake8 --version
- python -m flake8 --version
# stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. Two space indentation is OK. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --ignore=E111,E114,W503 --max-complexity=10 --max-line-length=127 --statistics
- python -m flake8 . --count --exit-zero --ignore=E111,E114,W503 --max-complexity=10 --max-line-length=127 --statistics
- npm install
- npm list
script:
- node -e 'require("npmlog").level="verbose"; require("./lib/find-python")(null,()=>{})'
- npm test
- GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" pytest
- GYP_MSVS_VERSION=2015 GYP_MSVS_OVERRIDE_PATH="C:\\Dummy" python -m pytest
notifications:
on_success: change
on_failure: change # `always` will be the setting once code changes slow down

0 comments on commit 345c70e

Please sign in to comment.