Skip to content

Commit

Permalink
remove pytest-virtualenv from test dependencies (incompatible with py…
Browse files Browse the repository at this point in the history
…312), remove generate_classes tests (implicitly CI tested by generating classes from mf6 develop), add py312 classifier to pyproject.toml, add xmipy to etc/environment.yml (replace bmipy), minor simplifications to autotest/conftest.py
  • Loading branch information
wpbonelli committed Nov 12, 2023
1 parent 696a209 commit 77369b1
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 177 deletions.
4 changes: 0 additions & 4 deletions .docs/md/generate_classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,3 @@ $ python -m flopy.mf6.utils.generate_classes --dfnpath ../your/dfn/path
Branch names, commit hashes, or tags may be provided to `ref`.

By default, a backup is made of FloPy's package classes before rewriting them. To disable backups, use `--no-backup` from command-line, or `backup=False` with the Python function.

## Testing class generation

Tests for the `generate_classes()` utility are located in `test_generate_classes.py`. The tests depend on [`pytest-virtualenv`](https://pypi.org/project/pytest-virtualenv/) and will be skipped if run in parallel without the `--dist loadfile` option for `pytest-xdist`.
9 changes: 1 addition & 8 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
python-version: [ 3.8, 3.9, "3.10", "3.11", "3.12" ]
exclude:
# avoid shutil.copytree infinite recursion bug
# https://github.com/python/cpython/pull/17098
Expand Down Expand Up @@ -193,13 +193,6 @@ jobs:
bash
powershell
- name: Install Python dependencies
shell: bash -l {0}
if: runner.os == 'Windows'
run: |
pip install xmipy
pip install .
- name: Install Modflow-related executables
uses: modflowpy/install-modflow-action@v1

Expand Down
28 changes: 4 additions & 24 deletions autotest/conftest.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
import importlib
import os
import re
import socket
import sys
from importlib import metadata
from os import environ
from os.path import basename, normpath
from pathlib import Path
from platform import system
from shutil import copytree, which
from subprocess import PIPE, Popen
from typing import List, Optional
from urllib import request
from warnings import warn
from typing import List

import matplotlib.pyplot as plt
import pytest
Expand All @@ -28,7 +18,7 @@
SHAPEFILE_EXTENSIONS = ["prj", "shx", "dbf"]


# misc utilities
# path utilities


def get_project_root_path() -> Path:
Expand All @@ -43,7 +33,7 @@ def get_flopy_data_path() -> Path:
return get_project_root_path() / "flopy" / "data"


# path fixtures
# fixtures


@pytest.fixture(scope="session")
Expand All @@ -66,11 +56,9 @@ def example_shapefiles(example_data_path) -> List[Path]:
return [f.resolve() for f in (example_data_path / "prj_test").glob("*")]


# fixture to automatically close any plots (or optionally show them)


@pytest.fixture(autouse=True)
def close_plot(request):
# fixture to automatically close any plots (or optionally show them)
yield

# plots only shown if requested via CLI flag,
Expand Down Expand Up @@ -118,14 +106,6 @@ def pytest_addoption(parser):
"but automated tests should probably also check patch collections or figure & axis properties.)",
)

# for test_generate_classes.py
parser.addoption(
"--ref",
action="append",
type=str,
help="Include extra refs to test. Useful for testing branches on a fork, e.g. <your GitHub username>/modflow6/<your branch>.",
)


def pytest_report_header(config):
"""Header for pytest to show versions of packages."""
Expand Down
138 changes: 0 additions & 138 deletions autotest/test_generate_classes.py

This file was deleted.

3 changes: 1 addition & 2 deletions etc/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ dependencies:
- pytest-cases
- pytest-cov
- pytest-dotenv
- pytest-virtualenv
- pytest-xdist
- virtualenv

Expand All @@ -52,4 +51,4 @@ dependencies:
- pymetis

# MODFLOW API dependencies
- bmipy
- xmipy
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ test = [
"pytest-cases",
"pytest-cov",
"pytest-dotenv",
"pytest-virtualenv",
"pytest-xdist",
"virtualenv"
]
Expand Down

0 comments on commit 77369b1

Please sign in to comment.