Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fedora 31 EOL preps and fix discovered when testing it #38

Merged
merged 3 commits into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
tox_env:
# This information is repeated in tox.ini
# (see https://github.com/fedora-python/tox-github-action/issues/8)
- py36-tox313
- py37-tox313
- py36-tox315
- py37-tox315
- py38-tox315
- py39-tox315

Expand Down
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ def long_description():
packages=find_packages("src"),
entry_points={"tox": ["current-env = tox_current_env.hooks"]},
install_requires=[
# We support tox 3.13 only to support Fedora 31.
# Fedora's tox 3.13 is patched to support Python 3.8 and 3.9,
# but the one downloaded from PyPI isn't and it doesn't work properly.
"tox>=3.15; python_version >= '3.8'",
"tox>=3.13; python_version < '3.8'",
"tox>=3.15",
"importlib_metadata; python_version < '3.8'"
],
python_requires=">=3.6",
Expand Down
14 changes: 8 additions & 6 deletions src/tox_current_env/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def tox_addoption(parser):
)


def _plugin_active(option):
return option.current_env or option.print_deps_to or option.print_extras_to


@tox.hookimpl
def tox_configure(config):
"""Stores options in the config. Makes all commands external and skips sdist"""
Expand All @@ -65,7 +69,7 @@ def tox_configure(config):
"--print-deps-only cannot be used together "
+ "with --print-deps-to"
)
if config.option.current_env or config.option.print_deps_to or config.option.print_extras_to:
if _plugin_active(config.option):
config.skipsdist = True
for testenv in config.envconfigs:
config.envconfigs[testenv].whitelist_externals = "*"
Expand Down Expand Up @@ -114,8 +118,7 @@ def rm_venv(venv):
def unsupported_raise(config, venv):
if config.option.recreate:
return
regular = not (config.option.current_env or config.option.print_deps_to or config.option.print_extras_to)
if regular and is_current_env_link(venv):
if not _plugin_active(config.option) and is_current_env_link(venv):
if hasattr(tox.hookspecs, "tox_cleanup"):
raise tox.exception.ConfigError(
"Looks like previous --current-env, --print-deps-to or --print-extras-to tox run didn't finish the cleanup. "
Expand Down Expand Up @@ -190,7 +193,7 @@ def tox_testenv_install_deps(venv, action):
"""We don't install anything"""
config = venv.envconfig.config
unsupported_raise(config, venv)
if config.option.current_env or config.option.print_deps_to or config.option.print_extras_to:
if _plugin_active(config.option):
return True


Expand Down Expand Up @@ -238,8 +241,7 @@ def tox_cleanup(session):
def tox_runenvreport(venv, action):
"""Prevent using pip to display installed packages,
use importlib.metadata instead, but fallback to default without our flags."""
option = venv.envconfig.config.option
if not (option.current_env or option.print_deps_only):
if not _plugin_active(venv.envconfig.config.option):
return None
return (
"{}=={}".format(d.metadata.get("name"), d.version)
Expand Down
11 changes: 0 additions & 11 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import configparser
import contextlib

from packaging import version

import pytest


Expand Down Expand Up @@ -97,10 +95,6 @@ def is_available(python):
return True


TOX_VERSION = version.parse(tox("--version").stdout.split(" ")[0])
TOX313 = TOX_VERSION < version.parse("3.14")


needs_py36789 = pytest.mark.skipif(
not all((is_available(f"python3.{x}") for x in range(6, 10))),
reason="This test needs python3.6, 3.7, 3.8 and 3.9 available in $PATH",
Expand Down Expand Up @@ -398,11 +392,6 @@ def test_regular_run():
assert "/.tox/py39 is the exec_prefix" in lines[3]
assert "congratulations" in result.stdout
for y in 6, 7, 8, 9:
if TOX313 and y > 8:
# there is a bug in tox < 3.14,
# it creates venv with /usr/bin/python3 if the version is unknown
# See https://src.fedoraproject.org/rpms/python-tox/pull-request/15
continue
for pkg in "py", "six", "test":
sitelib = DOT_TOX / f"py3{y}/lib/python3.{y}/site-packages"
assert sitelib.is_dir()
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

# This information is repeated in .github/workflows/main.yaml
# (see https://github.com/fedora-python/tox-github-action/issues/8)
envlist = {py36,py37,py38,py39}-tox{release,master},{py36,py37}-tox313,{py38,py39}-tox315
envlist = {py36,py37,py38,py39}-tox{release,master,tox315}

[testenv]
deps=
pytest
pytest-xdist
packaging
tox313: tox >=3.13,<3.14
tox315: tox >=3.15,<3.16
toxrelease: tox
toxmaster: git+https://github.com/tox-dev/tox.git@master
Expand Down