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

fix: always pull versions from metadata #782

Merged
merged 1 commit into from
Feb 24, 2024
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
11 changes: 9 additions & 2 deletions nox/tox_to_nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@
import os
import pkgutil
import re
import sys
from configparser import ConfigParser
from pathlib import Path
from subprocess import check_output
from typing import Any, Iterable

import jinja2
import tox.config
from tox import __version__ as TOX_VERSION

TOX4 = TOX_VERSION[0] == "4"
if sys.version_info < (3, 8):
import importlib_metadata as metadata
else:
from importlib import metadata

TOX_VERSION = metadata.version("tox")

TOX4 = int(TOX_VERSION.split(".")[0]) >= 4

if TOX4:
_TEMPLATE = jinja2.Template(
Expand Down
3 changes: 1 addition & 2 deletions tests/test_tox_to_nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
import textwrap

import pytest
from tox import __version__ as TOX_VERSION

tox_to_nox = pytest.importorskip("nox.tox_to_nox")

TOX4 = TOX_VERSION[0] == "4"
TOX4 = tox_to_nox.TOX4
PYTHON_VERSION = f"{sys.version_info.major}.{sys.version_info.minor}"
PYTHON_VERSION_NODOT = PYTHON_VERSION.replace(".", "")

Expand Down
8 changes: 6 additions & 2 deletions tests/test_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@
from unittest import mock

import pytest
import virtualenv
from packaging import version

import nox.virtualenv

if sys.version_info < (3, 8):
import importlib_metadata as metadata
else:
from importlib import metadata

IS_WINDOWS = nox.virtualenv._SYSTEM == "Windows"
HAS_CONDA = shutil.which("conda") is not None
HAS_UV = shutil.which("uv") is not None
RAISE_ERROR = "RAISE_ERROR"
VIRTUALENV_VERSION = virtualenv.__version__
VIRTUALENV_VERSION = metadata.version("virtualenv")


class TextProcessResult(NamedTuple):
Expand Down
Loading