Skip to content

Commit

Permalink
refactor: remove pytest-virtual from test deps, support py3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Nov 9, 2023
1 parent e464c40 commit 6cc044c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ dmypy.json
# Pyre type checker
.pyre/

# pycharme
# IDEs
.idea/
.vscode/

# downloaded exe
modflow_devtools/bin/
Expand Down
33 changes: 4 additions & 29 deletions modflow_devtools/test/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
get_namefile_paths,
get_packages,
has_package,
has_pkg,
set_dir,
set_env,
timed,
Expand Down Expand Up @@ -255,35 +256,9 @@ def test_get_namefile_paths_select_packages():
assert len(paths) >= 43


@pytest.mark.slow
def test_has_pkg(virtualenv):
python = virtualenv.python
venv = Path(python).parent
pkg = "pytest"
dep = "pluggy"
print(
f"Using temp venv at {venv} with python {python} to test has_pkg('{pkg}') with and without '{dep}'"
)

# install a package and remove one of its dependencies
virtualenv.run(f"pip install {project_root_path}")
virtualenv.run(f"pip install {pkg}")
virtualenv.run(f"pip uninstall -y {dep}")

# check with/without strict mode
for strict in [False, True]:
cmd = (
f"from modflow_devtools.misc import has_pkg; print(has_pkg('{pkg}'"
+ (", strict=True))" if strict else "))")
)
exp = "False" if strict else "True"
assert (
virtualenv.run(
f'{python} -c "{cmd}"',
capture=True,
).strip()
== exp
)
def test_has_pkg():
assert has_pkg("pytest")
assert not has_pkg("notapkg")


def test_timed1(capfd):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Hydrology"
]
requires-python = ">=3.8"
Expand All @@ -58,7 +59,6 @@ test = [
"pytest-cases",
"pytest-cov",
"pytest-dotenv",
"pytest-virtualenv",
"pytest-xdist",
"PyYaml"
]
Expand Down

0 comments on commit 6cc044c

Please sign in to comment.