-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: support python 3.12, various updates (#124)
* add python 3.12 classifier to `pyproject.toml` * explicitly specify packages in `pyproject.toml` * add authors to `pyproject.toml` * remove version fn from `Executables` * move tests from main module to `autotest/` * remove `BIN_PATH` testing environment variable * remove testing dependency on mf6 & related exes * remove `pytest-virtualenv` testing dependency * add `.vscode/` to `.gitignore`
- Loading branch information
Showing
23 changed files
with
206 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
modflow_devtools/test/test_download.py → autotest/test_download.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
from shutil import which | ||
|
||
import pytest | ||
|
||
from modflow_devtools.executables import Executables | ||
from modflow_devtools.misc import add_sys_path, get_suffixes | ||
|
||
ext, _ = get_suffixes(sys.platform) | ||
exe_stem = "pytest" | ||
exe_path = Path(which(exe_stem)) | ||
bin_path = exe_path.parent | ||
exe = f"{exe_stem}{ext}" | ||
|
||
|
||
@pytest.fixture | ||
def exes(): | ||
with add_sys_path(bin_path): | ||
yield Executables(**{exe_stem: bin_path / exe}) | ||
|
||
|
||
def test_access(exes): | ||
# support both attribute and dictionary style access | ||
assert exes.pytest == exes["pytest"] == exe_path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from os import environ | ||
from platform import python_version, system | ||
from shutil import which | ||
|
||
from packaging.version import Version | ||
|
||
from modflow_devtools.markers import * | ||
|
||
exe = "pytest" | ||
|
||
|
||
@requires_exe(exe) | ||
def test_require_exe(): | ||
assert which(exe) | ||
require_exe(exe) | ||
require_program(exe) | ||
|
||
|
||
exes = [exe, "python"] | ||
|
||
|
||
@require_exe(*exes) | ||
def test_require_exe_multiple(): | ||
assert all(which(exe) for exe in exes) | ||
|
||
|
||
@requires_pkg("pytest") | ||
def test_requires_pkg(): | ||
import numpy | ||
|
||
assert numpy is not None | ||
|
||
|
||
@requires_pkg("pytest", "pluggy") | ||
def test_requires_pkg_multiple(): | ||
import pluggy | ||
import pytest | ||
|
||
assert pluggy is not None and pytest is not None | ||
|
||
|
||
@requires_platform("Windows") | ||
def test_requires_platform(): | ||
assert system() == "Windows" | ||
|
||
|
||
@excludes_platform("Darwin", ci_only=True) | ||
def test_requires_platform_ci_only(): | ||
if "CI" in environ: | ||
assert system() != "Darwin" | ||
|
||
|
||
py_ver = python_version() | ||
|
||
|
||
@pytest.mark.parametrize("version", ["3.12", "3.11"]) | ||
def test_requires_python(version): | ||
if Version(py_ver) >= Version(version): | ||
assert requires_python(version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from platform import system | ||
|
||
import pytest | ||
|
||
from modflow_devtools.ostags import ( | ||
OSTag, | ||
get_binary_suffixes, | ||
|
Oops, something went wrong.