Skip to content

Commit

Permalink
tests: include printout of installed packages of interest
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Dec 1, 2022
1 parent 7989921 commit a9a5f94
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ codecov>=2.0.5
coverage>=4.2
cython>=0.25.1
flake8>=3.0.4
importlib-metadata;python_version<"3.8"
path.py>=11.5.0
pytest>=6.0.0
pytest-cov>=2.7.1
Expand Down
29 changes: 29 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

import pytest

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


DIR = os.path.dirname(os.path.abspath(__file__))
BASE = os.path.dirname(DIR)

Expand Down Expand Up @@ -43,3 +49,26 @@ def pep518(pep518_wheelhouse, monkeypatch):
monkeypatch.setenv("PIP_FIND_LINKS", pep518_wheelhouse)
monkeypatch.setenv("PIP_NO_INDEX", "true")
return pep518_wheelhouse


def pytest_report_header() -> str:
interesting_packages = {
"build",
"distro",
"packaging",
"pip",
"setuptools",
"virtualenv",
"wheel",
}
valid = []
for package in interesting_packages:
try:
version = metadata.version(package) # type: ignore[no-untyped-call]
except ModuleNotFoundError:
continue
valid.append(f"{package}=={version}")
reqs = " ".join(sorted(valid))
pkg_line = f"installed packages of interest: {reqs}"

return "\n".join([pkg_line])

0 comments on commit a9a5f94

Please sign in to comment.