Skip to content

Commit

Permalink
Minor CI Improvements (#235)
Browse files Browse the repository at this point in the history
* pre-commit now always dumps the test coverage report to the console. All other pre-commit stages do not have this behavior as they will spam the logs.

* Minor documentation changes to the Makefile

* Pytest will now error on warnings.

* Adds some notes in the pytest config file

* Adds Python 3.13 test; removes redundant check on 3.11

* Removes 3.13 test and adds deprecation warning notes for deadlock warning in 3.12

* Adds note about Pytest Unraisable warning
  • Loading branch information
schuylermartin45 authored Nov 8, 2024
1 parent d8dec77 commit d19b1c7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/commit_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
name: Test on ${{ matrix.python-version }}
strategy:
matrix:
python-version: ["3.11", "3.12"]
# NOTE: 3.11 is skipped as it is covered by the `pre-commit` job.
python-version: ["3.12"]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup-env
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,4 @@ repos:
always_run: true
pass_filenames: false
entry: make test-cov
verbose: true
11 changes: 11 additions & 0 deletions .pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# This surpresses deprecation `pytest` warnings related to using `conda.*` packages.
[pytest]
filterwarnings =
# Turns warnings into errors so we are alerted in the CI pipeline
error
# Further investigation needed, but this seems tied to the complex mockers used in the `fetcher` module. Tracked in
# Issue #237
# - https://docs.pytest.org/en/stable/reference/reference.html#pytest.PytestUnraisableExceptionWarning
ignore::pytest.PytestUnraisableExceptionWarning
# Root cause unclear, may be caused by `xdist` implementation for Linux. Tracked in Issue #236
# - https://github.com/python/cpython/issues/100228
# - https://github.com/python/cpython/pull/100229
ignore::DeprecationWarning:multiprocessing.popen_fork
# Deprecation warnings from `conda`
ignore::DeprecationWarning:boltons.*
ignore::DeprecationWarning:xdist.*
addopts = --ignore=tests/test_aux_files
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export PRINT_HELP_PYSCRIPT

BROWSER := python -c "$$BROWSER_PYSCRIPT"

clean: clean-test clean-build clean-env clean-docs ## remove all build, test, coverage, and Python artifacts
clean: clean-test clean-build clean-env clean-docs ## Removes all build, test, coverage, and Python artifacts

clean-build: ## remove build and Python artifacts
clean-build: ## Removes build and Python artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
Expand All @@ -54,7 +54,7 @@ clean-build: ## remove build and Python artifacts
clean-env: ## remove conda environment
conda remove -y -n $(CONDA_ENV_NAME) --all

clean-test: ## remove test, coverage, and profiler artifacts
clean-test: ## Removes test, coverage, and profiler artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
Expand All @@ -72,33 +72,33 @@ clean-docs: ## Removes temporary and auto-generated static doc files
help:
$(PYTHON3) -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

dev: clean ## install the package's development version to a fresh environment
dev: clean ## Installs the package's development version to a fresh environment
conda env create -f environment.yaml --name $(CONDA_ENV_NAME) --yes
conda run --name $(CONDA_ENV_NAME) pip install -e .
$(CONDA_ACTIVATE) $(CONDA_ENV_NAME) && pre-commit install

pre-commit: ## runs pre-commit against files. NOTE: older files are disabled in the pre-commit config.
pre-commit: ## Runs pre-commit against files.
pre-commit run --all-files

test: ## runs test cases
test: ## Runs test cases
$(PYTHON3) -m pytest -n auto --capture=no $(TEST_DIR)

test-cov: ## checks test coverage requirements
test-cov: ## Checks test coverage requirements
$(PYTHON3) -m pytest -n auto --cov-config=.coveragerc --cov=$(SRC_DIR) \
$(TEST_DIR) --cov-fail-under=80 --cov-report term-missing

lint: ## runs the linter against the project
lint: ## Runs the linter against the project
pylint --rcfile=.pylintrc $(SRC_DIR) $(TEST_DIR)

format: ## runs the code auto-formatter
format: ## Runs the code auto-formatter
isort --profile black --line-length=120 $(SRC_DIR) $(TEST_DIR) $(SCRIPTS_DIR)
black --line-length=120 $(SRC_DIR) $(TEST_DIR) $(SCRIPTS_DIR)

format-docs: ## runs the docstring auto-formatter. NOTE: this requires manually installing `docconvert` with `pip`
format-docs: ## Runs the docstring auto-formatter. NOTE: this requires manually installing `docconvert` with `pip`
docconvert --in-place --config .docconvert.json $(SRC_DIR)

analyze: ## runs static analyzer on the project
analyze: ## Runs static analyzer on the project
mypy --config-file=.mypy.ini --cache-dir=/dev/null $(SRC_DIR) $(TEST_DIR) $(SCRIPTS_DIR)

docs: clean-docs ## generates static html documentation
docs: clean-docs ## Generates static html documentation
$(MAKE) -C docs html

0 comments on commit d19b1c7

Please sign in to comment.