Skip to content

Commit

Permalink
Get tests working again
Browse files Browse the repository at this point in the history
  • Loading branch information
aragilar committed Aug 13, 2021
1 parent d05baa8 commit 3efb2ca
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
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 3efb2ca

Please sign in to comment.