diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..55c84d6 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,76 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + tests: + name: Python ${{ matrix.python-version }} + runs-on: ubuntu-20.04 + + strategy: + matrix: + python-version: + - 2.7 + - 3.7 + - 3.8 + - 3.9 + - '3.10' + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade tox + + - name: Run tox targets for ${{ matrix.python-version }} + run: | + ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}") + TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') tox + + - name: Upload coverage data + uses: actions/upload-artifact@v2 + with: + name: coverage-data + path: '.coverage.*' + + coverage: + name: Coverage + runs-on: ubuntu-20.04 + needs: tests + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Install dependencies + run: python -m pip install --upgrade coverage[toml] + + - name: Download data + uses: actions/download-artifact@v2 + with: + name: coverage-data + + - name: Combine coverage and fail if it's <100% + run: | + python -m coverage combine + python -m coverage html --skip-covered --skip-empty + python -m coverage report --fail-under=55 + + - name: Upload HTML report + if: ${{ failure() }} + uses: actions/upload-artifact@v2 + with: + name: html-report + path: htmlcov diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ef12b58..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: python -python: - - 2.7 - - 3.6 - - 3.7 - - pypy -install: pip install coveralls tox-travis -script: tox -after_success: - - coveralls -sudo: false diff --git a/nodeenv.py b/nodeenv.py index 2ca89ea..9802686 100644 --- a/nodeenv.py +++ b/nodeenv.py @@ -356,7 +356,8 @@ def make_parser(): help='Ignore certificates for package downloads. - UNSAFE -') parser.add_argument( - metavar='DEST_DIR', dest='env_dir', nargs='?', help='Destination directory') + metavar='DEST_DIR', dest='env_dir', nargs='?', + help='Destination directory') return parser diff --git a/setup.py b/setup.py index eb4c759..c755cfd 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,9 @@ def read_file(file_name): author='Eugene Kalinin', author_email='e.v.kalinin@gmail.com', install_requires=['setuptools'], + python_requires=( + ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" + ), description="Node.js virtual environment builder", long_description=ldesc, py_modules=['nodeenv'], @@ -49,8 +52,10 @@ def read_file(file_name): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Libraries :: Python Modules' diff --git a/tests/nodeenv_test.py b/tests/nodeenv_test.py index 752b6d4..a623707 100644 --- a/tests/nodeenv_test.py +++ b/tests/nodeenv_test.py @@ -46,7 +46,7 @@ def test_smoke_n_system_special_chars(tmpdir): ]) -@pytest.yield_fixture +@pytest.fixture def mock_index_json(): # retrieved 2019-12-31 with open(os.path.join(HERE, 'nodejs_index.json'), 'rb') as f: @@ -54,7 +54,7 @@ def mock_index_json(): yield -@pytest.yield_fixture +@pytest.fixture def cap_logging_info(): with mock.patch.object(nodeenv.logger, 'info') as mck: yield mck diff --git a/tests/test_install_activate.py b/tests/test_install_activate.py index 80e32ad..d729fd1 100644 --- a/tests/test_install_activate.py +++ b/tests/test_install_activate.py @@ -52,7 +52,7 @@ def test_write(tmpdir, name, content_var): bin_dir.join(n).write(n) with mock.patch.object(sys, 'argv', ['nodeenv', str(tmpdir)]): - opts = nodeenv.parse_args()[0] + opts = nodeenv.parse_args() nodeenv.install_activate(str(tmpdir), opts) content = getattr(nodeenv, content_var) @@ -70,7 +70,7 @@ def test_python_virtualenv(tmpdir, name, content_var): bin_dir.join(n).write(n) with mock.patch.object(sys, 'argv', ['nodeenv', '-p']): - opts = nodeenv.parse_args()[0] + opts = nodeenv.parse_args() nodeenv.install_activate(str(tmpdir), opts) content = getattr(nodeenv, content_var) diff --git a/tox.ini b/tox.ini index 80b9ab4..4fea8e0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] -# These should match the travis env list -envlist = py27,py36,py37,pypy +# These should match the GitHub Actions env list +envlist = py27,py37,py38,py39,py310 [testenv] install_command = pip install {opts} {packages} @@ -8,24 +8,13 @@ deps = -rrequirements-dev.txt setenv = LANG=en_US.UTF-8 commands = - coverage erase coverage run -p -m pytest {posargs:tests} - # Needed because we subprocess to ourselves - coverage combine - coverage report --show-missing --fail-under 55 # TODO: 100 flake8 --extend-ignore=E127 nodeenv.py tests setup.py [testenv:venv] envdir = venv-nodeenv commands = -[testenv:docs] -deps = - {[testenv]deps} - sphinx -changedir = docs -commands = sphinx-build -b html -d build/doctrees source build/html - [pytest] markers = integration: tests that take a little bit longer