Skip to content

Commit

Permalink
Merge pull request #8 from aragilar/fix-tests
Browse files Browse the repository at this point in the history
Get tests working again
  • Loading branch information
aragilar authored Aug 13, 2021
2 parents d05baa8 + dd0322a commit de823a4
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 16 deletions.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ recursive-include tests *.py
include pylintrc
include tox.ini
exclude appveyor.yml
exclude bors.toml
exclude azure-pipelines.yml
recursive-exclude ci *
87 changes: 87 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# from matplotlib's azure setup


schedules:
- cron: "0 0 * * 4"
displayName: Weekly build
branches:
include:
- releases/*
always: true


trigger:
tags:
include:
- '*'
branches:
include:
- '*'


variables:
PIP_CACHE_DIR: $(Pipeline.Workspace)/cache/pip


jobs:
- job: 'static_checks'
pool:
vmImage: ubuntu-16.04
variables:
TOXENV: flake8,pylint,docs,doctest,check-manifest,checkreadme
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
architecture: 'x64'
- script: |
pip install tox
displayName: Install tox
- script: |
tox
displayName: tox
- job: 'ubuntu1604'
pool:
vmImage: ubuntu-16.04
strategy:
matrix:
py36:
python.version: '3.6'
TOXENV: py36
py37:
python.version: '3.7'
TOXENV: py37
py38:
python.version: '3.8'
TOXENV: py38
py39:
python.version: '3.9'
TOXENV: py39
maxParallel: 4

steps:
- template: ci/azure-pipelines-steps.yml
parameters:
platform: linux

- job: 'macOS1015'
pool:
vmImage: macOS-10.15
strategy:
matrix:
py37:
python.version: '3.7'
TOXENV: py37
py38:
python.version: '3.8'
TOXENV: py38
py39:
python.version: '3.9'
TOXENV: py39
maxParallel: 4

steps:
- template: ci/azure-pipelines-steps.yml
parameters:
platform: macos
6 changes: 6 additions & 0 deletions bors.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
status = [
"venv_tools.venv_tools",
"codecov/patch",
"codecov/project",
]

38 changes: 38 additions & 0 deletions ci/azure-pipelines-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
displayName: 'Use Python $(python.version)'
condition: and(succeeded(), ne(variables['python.version'], 'Pre'))

- script: |
python -m pip install --upgrade pip
pip install tox codecov twine wheel
displayName: 'Install pip dependencies'

- task: TwineAuthenticate@0
inputs:
externalFeeds: 'pypi'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')

- script: env
displayName: 'print env'

- script: |
tox
displayName: 'tox'

#- script: |
# codecov
# displayName: 'codecov'
# hopefully the bash uploader will work
- script: |
bash <(curl -s https://codecov.io/bash)
displayName: 'Upload to codecov.io'

- script: |
python setup.py sdist bdist_wheel
twine upload --skip-existing -r pypi --config-file $(PYPIRC_PATH) dist/*
displayName: 'Upload to PyPI'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=bad-continuation,invalid-name,too-few-public-methods,logging-format-interpolation
disable=bad-continuation,invalid-name,too-few-public-methods,logging-format-interpolation,useless-object-inheritance


[SIMILARITIES]
Expand Down
23 changes: 14 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,34 +1,41 @@
[tox]
envlist = py35,py36,py37,docs,flake8,pylint,check-manifest,checkreadme
envlist = py35,py36,py37,py38,py39,docs,flake8,pylint,check-manifest,checkreadme

[testenv]
deps =
-rtest-requirements.txt
commands = py.test --cov={envsitepackagesdir}/venv_tools -s {posargs}
passenv =
TOXPYTHON
commands = pytest --cov={envsitepackagesdir}/venv_tools -s {posargs}
basepython =
py35: {env:TOXPYTHON:python3.5}
py36: {env:TOXPYTHON:python3.6}
py37: {env:TOXPYTHON:python3.7}
py38: {env:TOXPYTHON:python3.8}
py39: {env:TOXPYTHON:python3.9}
flake8: {env:TOXPYTHON:python3}
pylint: {env:TOXPYTHON:python3}
docs: {env:TOXPYTHON:python3}
doctest: {env:TOXPYTHON:python3}
check-manifest: {env:TOXPYTHON:python3}
checkreadme: {env:TOXPYTHON:python3}

[testenv:docs]
changedir=docs
deps=
-rdoc-requirements.txt
commands=
sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
basepython= {env:TOXPYTHON:python3}

[testenv:flake8]
deps=
flake8
commands=
flake8 --exclude={envsitepackagesdir}/venv_tools/_version.py {envsitepackagesdir}/venv_tools
basepython= {env:TOXPYTHON:python3}

[testenv:pylint]
deps=
pylint
commands=
pylint {envsitepackagesdir}/venv_tools
basepython= {env:TOXPYTHON:python3}

[testenv:check-manifest]
deps=
Expand All @@ -37,11 +44,9 @@ setenv =
CHECK_MANIFEST=true
commands=
check-manifest
basepython= {env:TOXPYTHON:python3}

[testenv:checkreadme]
deps=
readme_renderer
commands=
python setup.py check -s -r
basepython= {env:TOXPYTHON:python3}
5 changes: 2 additions & 3 deletions venv_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,8 @@ def __init__(
path_to_python_exe = abspath_python_exe(python_exe)

self._kwargs = kwargs
self._venv_builder = (
venv_builder or
get_default_venv_builder(use_virtualenv, path_to_python_exe)
self._venv_builder = venv_builder or get_default_venv_builder(
use_virtualenv, path_to_python_exe,
)
self._path_to_python_exe = path_to_python_exe
self.env_dir = None
Expand Down
8 changes: 5 additions & 3 deletions venv_tools/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ def get_default_venv_builder(use_virtualenv, path_to_python_exe):
"""
if path_to_python_exe:
return VirtualenvBuilder
elif use_virtualenv:
if use_virtualenv:
return VirtualenvBuilder
try:
import venv
import venv # pylint: disable=import-outside-toplevel
if sys.version_info[0:2] == (3, 3):
return VirtualenvBuilder
return venv.EnvBuilder
Expand All @@ -89,14 +89,16 @@ def get_default_venv_builder(use_virtualenv, path_to_python_exe):
def is_virtualenv(path):
"""
Checks whether `path` is a virtualenv.
This function is somewhat redundant now that virtualenv uses venv
"""
if pth.exists(pth.join(path, BIN_DIR, "python")):
# we might have a virtualenv (/usr would pass the above test)
activate_exists = any(
pth.exists(pth.join(path, BIN_DIR, f))
for f in ACTIVATE_FILENAMES
)
if activate_exists and not is_pep_405_venv(path):
if activate_exists:
return True
return False

Expand Down

0 comments on commit de823a4

Please sign in to comment.