pytest-vivarium 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. pytest_vivarium-0.1.0/.readthedocs.yaml +37 -0
  2. pytest_vivarium-0.1.0/CHANGELOG.rst +5 -0
  3. pytest_vivarium-0.1.0/Jenkinsfile +40 -0
  4. pytest_vivarium-0.1.0/LICENSE +27 -0
  5. pytest_vivarium-0.1.0/Makefile +101 -0
  6. pytest_vivarium-0.1.0/PKG-INFO +75 -0
  7. pytest_vivarium-0.1.0/README.rst +31 -0
  8. pytest_vivarium-0.1.0/docs/Makefile +22 -0
  9. pytest_vivarium-0.1.0/docs/nitpick-exceptions +4 -0
  10. pytest_vivarium-0.1.0/docs/source/_static/.gitkeep +0 -0
  11. pytest_vivarium-0.1.0/docs/source/conf.py +235 -0
  12. pytest_vivarium-0.1.0/docs/source/index.rst +47 -0
  13. pytest_vivarium-0.1.0/pyproject.toml +106 -0
  14. pytest_vivarium-0.1.0/python_versions.json +1 -0
  15. pytest_vivarium-0.1.0/setup.cfg +4 -0
  16. pytest_vivarium-0.1.0/src/pytest_vivarium/__init__.py +12 -0
  17. pytest_vivarium-0.1.0/src/pytest_vivarium/plugin.py +271 -0
  18. pytest_vivarium-0.1.0/src/pytest_vivarium/py.typed +0 -0
  19. pytest_vivarium-0.1.0/src/pytest_vivarium.egg-info/PKG-INFO +75 -0
  20. pytest_vivarium-0.1.0/src/pytest_vivarium.egg-info/SOURCES.txt +27 -0
  21. pytest_vivarium-0.1.0/src/pytest_vivarium.egg-info/dependency_links.txt +1 -0
  22. pytest_vivarium-0.1.0/src/pytest_vivarium.egg-info/entry_points.txt +2 -0
  23. pytest_vivarium-0.1.0/src/pytest_vivarium.egg-info/requires.txt +24 -0
  24. pytest_vivarium-0.1.0/src/pytest_vivarium.egg-info/scm_file_list.json +23 -0
  25. pytest_vivarium-0.1.0/src/pytest_vivarium.egg-info/scm_version.json +8 -0
  26. pytest_vivarium-0.1.0/src/pytest_vivarium.egg-info/top_level.txt +1 -0
  27. pytest_vivarium-0.1.0/tests/__init__.py +0 -0
  28. pytest_vivarium-0.1.0/tests/test_package.py +34 -0
  29. pytest_vivarium-0.1.0/tests/test_plugin.py +234 -0
@@ -0,0 +1,37 @@
1
+ # Paths are repo-root-relative even when this file lives in a subdirectory,
2
+ # so the package path must be qualified with libs/pytest-vivarium/.
3
+ #
4
+ # This file is read by RTD only when the pytest-vivarium RTD
5
+ # project's Admin > Advanced Settings > "Path for .readthedocs.yaml" points
6
+ # here. The root-level /.readthedocs.yaml is a placeholder used by the
7
+ # import wizard and ignored for any project that has overridden the path.
8
+ version: 2
9
+
10
+ sphinx:
11
+ configuration: libs/pytest-vivarium/docs/source/conf.py
12
+ fail_on_warning: true
13
+
14
+ build:
15
+ os: ubuntu-22.04
16
+ tools:
17
+ python: "3.13"
18
+ jobs:
19
+ post_checkout:
20
+ - git fetch --unshallow origin 2>/dev/null || git fetch origin main
21
+ # Cancel PR (external) builds that don't touch this lib (Exit 183 is RTD's
22
+ # signal to cancel the build immediately).
23
+ - |
24
+ if [ "$READTHEDOCS_VERSION_TYPE" = "external" ] && git diff --quiet "origin/main...HEAD" -- libs/pytest-vivarium/; then
25
+ echo "Skipping docs build: this PR changes nothing under libs/pytest-vivarium/."
26
+ exit 183
27
+ fi
28
+
29
+ python:
30
+ install:
31
+ - method: pip
32
+ path: libs/pytest-vivarium
33
+ extra_requirements:
34
+ - docs
35
+
36
+ formats:
37
+ - pdf
@@ -0,0 +1,5 @@
1
+ **0.1.0 - 07/23/26**
2
+
3
+ - Initial release: pytest plugin extracted from vivarium-testing-utils,
4
+ providing the slow/weekly/cluster markers, the memory-aware -n auto worker
5
+ cap, and the no_gbd_cache fixture.
@@ -0,0 +1,40 @@
1
+ /* This Jenkinsfile simply loads the `reusable_pipeline` pipeline from the
2
+ vivarium-build-utils package, which lives at ``libs/build-utils/`` inside the
3
+ ``ihmeuw/vivarium-suite`` monorepo (https://github.com/ihmeuw/vivarium-suite).
4
+
5
+ vivarium-build-utils is loaded as a Jenkins shared library
6
+ (https://www.jenkins.io/doc/book/pipeline/shared-libraries/).
7
+ Jenkins shared library convention dictates that importable modules must be stored
8
+ in the 'vars' folder.
9
+
10
+ Jenkins shared libraries can be configured in the Jenkins UI:
11
+ * Manage Jenkins
12
+ * Configure System
13
+ * Global Pipeline Libraries section
14
+ * Library subsection
15
+ * Name: The Name for the lib
16
+ * Version: The branch you want to use. Throws an error
17
+ for nonexistent branches.
18
+ * Project Repository: Url to the shared lib
19
+ * Credentials: SSH key to access the repo
20
+
21
+ Note that updating the shared repo will take effect on the next pipeline invocation.
22
+ */
23
+
24
+ // Load the get_vbu_version function from build-utils/bootstrap/
25
+ // (the directory to load from is defined in the Jenkins shared library configuration)
26
+ @Library("get_vbu_version@main") _
27
+
28
+ // Load the full vivarium_build_utils library at the expected version
29
+ library("vivarium_build_utils@${get_vbu_version()}")
30
+
31
+ reusable_pipeline(
32
+ scheduled_branches: [
33
+ // Add additional branches for cron jobs below.
34
+ // Note: Newly added branches will require a manual trigger of the first build
35
+ // for subsequent scheduled builds to run.
36
+ "main",
37
+ ],
38
+ skip_doc_build: true,
39
+ env_reqs: "ci_jenkins",
40
+ )
@@ -0,0 +1,27 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright 2024 Institute for Health Metrics and Evaluation
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this list
9
+ of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice, this
12
+ list of conditions and the following disclaimer in the documentation and/or other
13
+ materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its contributors may
16
+ be used to endorse or promote products derived from this software without specific
17
+ prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY
20
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
22
+ SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24
+ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,101 @@
1
+ # Check if we're running in Jenkins
2
+ ifdef JENKINS_URL
3
+ # Files are already in workspace from shared library
4
+ MAKE_INCLUDES := .
5
+ else
6
+ # For local dev, use the installed vivarium.build_utils package if it exists
7
+ # First, check if we can import vivarium.build_utils and assign 'yes' or 'no'.
8
+ # We do this by importing the package in python and redirecting stderr to the null device.
9
+ # If the import is successful (&&), it will print 'yes', otherwise (||) it will print 'no'.
10
+ VIVARIUM_BUILD_UTILS_AVAILABLE := $(shell python -c "import vivarium.build_utils" 2>/dev/null && echo "yes" || echo "no")
11
+ # If vivarium.build_utils is available, get the makefiles path or else set it to empty
12
+ ifeq ($(VIVARIUM_BUILD_UTILS_AVAILABLE),yes)
13
+ MAKE_INCLUDES := $(shell python -c "from vivarium.build_utils.resources import get_makefiles_path; print(get_makefiles_path())")
14
+ else
15
+ MAKE_INCLUDES :=
16
+ endif
17
+ endif
18
+
19
+ # Set the package name as the last part of this file's parent directory path
20
+ PACKAGE_NAME = $(notdir $(CURDIR))
21
+
22
+ ifneq ($(MAKE_INCLUDES),) # not empty
23
+ # Include makefiles from vivarium.build_utils
24
+ include $(MAKE_INCLUDES)/base.mk
25
+ include $(MAKE_INCLUDES)/test.mk
26
+ else # empty
27
+ # Use this help message (since the vivarium.build_utils version is not available)
28
+ help:
29
+ @echo
30
+ @echo "For Make's standard help, run 'make --help'."
31
+ @echo
32
+ @echo "Most of our Makefile targets are provided by the vivarium.build_utils"
33
+ @echo "package. To access them, you need to create a development environment first."
34
+ @echo
35
+ @echo "make build-env"
36
+ @echo
37
+ @echo "USAGE:"
38
+ @echo " make build-env [name=<environment name>] [py=<python version>] [artifactory_access=<yes|no>]"
39
+ @echo
40
+ @echo "ARGUMENTS:"
41
+ @echo " name [optional]"
42
+ @echo " Name of the conda environment to create (defaults to <PACKAGE_NAME>)"
43
+ @echo " py [optional]"
44
+ @echo " Python version (defaults to latest supported)"
45
+ @echo " artifactory_access [optional]"
46
+ @echo " Whether the build host can reach the IHME artifactory. Either 'yes'"
47
+ @echo " (default) or 'no'; use 'no' to build off-VPN without artifactory."
48
+ @echo
49
+ @echo "After creating the environment:"
50
+ @echo " 1. Activate it: 'conda activate <environment_name>'"
51
+ @echo " 2. Run 'make help' again to see all newly available targets"
52
+ @echo
53
+ endif
54
+
55
+ build-env: # Create a new environment with installed packages
56
+ # Validate arguments - exit if unsupported arguments are passed
57
+ @allowed="name py artifactory_access"; \
58
+ for arg in $(filter-out build-env,$(MAKECMDGOALS)) $(MAKEFLAGS); do \
59
+ case $$arg in \
60
+ *=*) \
61
+ arg_name=$${arg%%=*}; \
62
+ if ! echo " $$allowed " | grep -q " $$arg_name "; then \
63
+ allowed_list=$$(echo $$allowed | sed 's/ /, /g'); \
64
+ echo "Error: Invalid argument '$$arg_name'. Allowed arguments are: $$allowed_list" >&2; \
65
+ exit 1; \
66
+ fi \
67
+ ;; \
68
+ esac; \
69
+ done
70
+
71
+ # Handle arguments and set defaults
72
+ # name
73
+ @$(eval name ?= $(PACKAGE_NAME))
74
+ # python version - validate if specified, else get default from json file
75
+ @supported_versions=$$(python -c "import json; print(' '.join(json.load(open('python_versions.json'))))" 2>/dev/null || echo ""); \
76
+ if [ -n "$(py)" ] && ! echo "$$supported_versions" | grep -q "$(py)"; then \
77
+ echo "Error: Python version '$(py)' is not supported. Available: $$(echo $$supported_versions | sed 's/ /, /g')" >&2; \
78
+ exit 1; \
79
+ fi
80
+ @$(eval py ?= $(shell python -c "import json; print(max(json.load(open('python_versions.json')), key=lambda x: tuple(map(int, x.split('.')))))"))
81
+ # artifactory_access
82
+ @$(eval artifactory_access ?= yes)
83
+ @case "$(artifactory_access)" in \
84
+ yes|no) ;; \
85
+ *) echo "Error: 'artifactory_access' must be 'yes' or 'no', got '$(artifactory_access)'" >&2; exit 1 ;; \
86
+ esac
87
+
88
+ conda create -n $(name) python=$(py) --yes
89
+ # Bootstrap vivarium.build_utils into the new environment
90
+ conda run -n $(name) pip install vivarium-build-utils
91
+ # artifactory_access=no passes an empty IHME_PYPI, which clears base.mk's EXTRA_INDEX_FLAGS
92
+ conda run -n $(name) make install $(if $(filter no,$(artifactory_access)),IHME_PYPI=)
93
+
94
+ @echo
95
+ @echo "Finished building environment"
96
+ @echo " name: $(name)"
97
+ @echo " python version: $(py)"
98
+ @echo
99
+ @echo "Don't forget to activate it with:"
100
+ @echo "conda activate $(name)"
101
+ @echo
@@ -0,0 +1,75 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-vivarium
3
+ Version: 0.1.0
4
+ Summary: Shared pytest configuration and fixtures for Vivarium projects.
5
+ Author-email: The vivarium developers <vivarium.dev@gmail.com>
6
+ License: BSD-3-Clause
7
+ Classifier: Framework :: Pytest
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Intended Audience :: Education
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: BSD License
12
+ Classifier: Natural Language :: English
13
+ Classifier: Operating System :: MacOS :: MacOS X
14
+ Classifier: Operating System :: POSIX
15
+ Classifier: Operating System :: POSIX :: BSD
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Programming Language :: Python
19
+ Classifier: Programming Language :: Python :: Implementation :: CPython
20
+ Classifier: Topic :: Education
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Topic :: Software Development :: Libraries
23
+ Classifier: Topic :: Software Development :: Testing
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/x-rst
26
+ License-File: LICENSE
27
+ Requires-Dist: vivarium-dependencies[numpy,pytest]
28
+ Requires-Dist: vivarium-build-utils<5.0.0,>=4.0.0
29
+ Requires-Dist: vivarium-config-tree
30
+ Provides-Extra: cluster
31
+ Provides-Extra: test
32
+ Provides-Extra: docs
33
+ Requires-Dist: vivarium-dependencies[docutils,sphinx]; extra == "docs"
34
+ Provides-Extra: interactive
35
+ Provides-Extra: lint
36
+ Requires-Dist: vivarium-dependencies[lint]; extra == "lint"
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest-vivarium[docs,interactive,lint,test]; extra == "dev"
39
+ Provides-Extra: ci-github
40
+ Requires-Dist: pytest-vivarium[docs,lint,test]; extra == "ci-github"
41
+ Provides-Extra: ci-jenkins
42
+ Requires-Dist: pytest-vivarium[ci_github,cluster]; extra == "ci-jenkins"
43
+ Dynamic: license-file
44
+
45
+ ===============
46
+ pytest-vivarium
47
+ ===============
48
+
49
+ A `pytest <https://docs.pytest.org/>`_ plugin providing the shared test
50
+ configuration used across the Institute for Health Metrics and Evaluation's
51
+ Simulation Science team's `Vivarium <https://vivarium-engine.readthedocs.io/en/latest/>`_
52
+ projects: the ``slow``/``weekly``/``cluster`` markers and their ``--runslow`` /
53
+ ``--runweekly`` / ``--slurm-project`` options, a memory- and CPU-aware ceiling on
54
+ ``pytest -n auto`` xdist workers, and the ``no_gbd_cache`` fixture.
55
+
56
+ It is one of the libraries in the
57
+ `vivarium-suite <https://github.com/ihmeuw/vivarium-suite>`_ monorepo.
58
+
59
+ **Supported Python versions: 3.10, 3.11**
60
+
61
+ Installation
62
+ ------------
63
+
64
+ .. code-block:: console
65
+
66
+ $ pip install pytest-vivarium
67
+
68
+ pytest discovers the plugin automatically via its ``pytest11`` entry point; there
69
+ is nothing to import or enable.
70
+
71
+ Documentation
72
+ -------------
73
+
74
+ Check out the `documentation <https://pytest-vivarium.readthedocs.io/en/latest/>`_
75
+ for the full list of markers, options, and fixtures.
@@ -0,0 +1,31 @@
1
+ ===============
2
+ pytest-vivarium
3
+ ===============
4
+
5
+ A `pytest <https://docs.pytest.org/>`_ plugin providing the shared test
6
+ configuration used across the Institute for Health Metrics and Evaluation's
7
+ Simulation Science team's `Vivarium <https://vivarium-engine.readthedocs.io/en/latest/>`_
8
+ projects: the ``slow``/``weekly``/``cluster`` markers and their ``--runslow`` /
9
+ ``--runweekly`` / ``--slurm-project`` options, a memory- and CPU-aware ceiling on
10
+ ``pytest -n auto`` xdist workers, and the ``no_gbd_cache`` fixture.
11
+
12
+ It is one of the libraries in the
13
+ `vivarium-suite <https://github.com/ihmeuw/vivarium-suite>`_ monorepo.
14
+
15
+ **Supported Python versions: 3.10, 3.11**
16
+
17
+ Installation
18
+ ------------
19
+
20
+ .. code-block:: console
21
+
22
+ $ pip install pytest-vivarium
23
+
24
+ pytest discovers the plugin automatically via its ``pytest11`` entry point; there
25
+ is nothing to import or enable.
26
+
27
+ Documentation
28
+ -------------
29
+
30
+ Check out the `documentation <https://pytest-vivarium.readthedocs.io/en/latest/>`_
31
+ for the full list of markers, options, and fixtures.
@@ -0,0 +1,22 @@
1
+ # Minimal makefile for Sphinx documentation
2
+
3
+ # You can set these variables from the command line.
4
+ SPHINXOPTS =
5
+ SPHINXBUILD = sphinx-build
6
+ SPHINXPROJ = pytest_vivarium
7
+ SOURCEDIR = source
8
+ BUILDDIR = build
9
+
10
+ # Put it first so that "make" without argument is like "make help".
11
+ help:
12
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13
+
14
+ .PHONY: help Makefile
15
+
16
+ # Catch-all target: route all unknown targets to Sphinx using the new
17
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18
+ %: Makefile
19
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
20
+
21
+ clean:
22
+ rm -rf build/*
@@ -0,0 +1,4 @@
1
+ # Add "py:class <target>" entries here for cross-references that Sphinx's
2
+ # nitpicky mode cannot resolve. Empty for now: these docs are narrative-only,
3
+ # so no autodoc-generated type references need suppressing. Populate this when
4
+ # the package starts auto-documenting its API.
File without changes
@@ -0,0 +1,235 @@
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+ #
4
+ # This file is execfile()d with the current directory set to its
5
+ # containing dir.
6
+ #
7
+ # Note that not all possible configuration values are present in this
8
+ # autogenerated file.
9
+ #
10
+ # All configuration values have a default; values that are commented out
11
+ # serve to show the default.
12
+
13
+ import importlib.metadata
14
+
15
+ from docutils.nodes import Text
16
+ from sphinx.ext.intersphinx import missing_reference
17
+
18
+ # -- Project information -----------------------------------------------------
19
+
20
+ project = "pytest-vivarium"
21
+ author = "The vivarium developers"
22
+ copyright = "2023, Institute for Health Metrics and Evaluation"
23
+
24
+ version = importlib.metadata.version("pytest-vivarium")
25
+ release = version
26
+
27
+
28
+ # -- General configuration ------------------------------------------------
29
+
30
+ # If your documentation needs a minimal Sphinx version, state it here.
31
+
32
+ needs_sphinx = "4.0"
33
+
34
+ # Add any Sphinx extension module names here, as strings. They can be
35
+ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
36
+ # ones.
37
+ extensions = [
38
+ "sphinx.ext.autodoc",
39
+ "sphinx.ext.intersphinx",
40
+ "sphinx.ext.doctest",
41
+ "sphinx.ext.todo",
42
+ "sphinx.ext.coverage",
43
+ "sphinx.ext.mathjax",
44
+ "sphinx.ext.napoleon",
45
+ "sphinx.ext.viewcode",
46
+ ]
47
+
48
+ # Add any paths that contain templates here, relative to this directory.
49
+ templates_path = ["_templates"]
50
+
51
+ # The suffix(es) of source filenames.
52
+ # You can specify multiple suffix as a list of string:
53
+ #
54
+ # source_suffix = ['.rst', '.md']
55
+ source_suffix = ".rst"
56
+
57
+ # The master toctree document.
58
+ master_doc = "index"
59
+
60
+ # General information about the project.
61
+
62
+
63
+ # The language for content autogenerated by Sphinx. Refer to documentation
64
+ # for a list of supported languages.
65
+ #
66
+ # This is also used if you do content translation via gettext catalogs.
67
+ # Usually you set "language" from the command line for these cases.
68
+ language = "en"
69
+
70
+ # List of patterns, relative to source directory, that match files and
71
+ # directories to ignore when looking for source files.
72
+ # This patterns also effect to html_static_path and html_extra_path
73
+ exclude_patterns = []
74
+
75
+ # The name of the Pygments (syntax highlighting) style to use.
76
+ pygments_style = "sphinx"
77
+
78
+ # If true, `todo` and `todoList` produce output, else they produce nothing.
79
+ todo_include_todos = True
80
+
81
+
82
+ # -- Options for HTML output ----------------------------------------------
83
+
84
+ # The theme to use for HTML and HTML Help pages. See the documentation for
85
+ # a list of builtin themes.
86
+
87
+ html_theme_path = ["_theme"]
88
+ html_theme = "sphinx_rtd_theme"
89
+
90
+ # Theme options are theme-specific and customize the look and feel of a theme
91
+ # further. For a list of options available for each theme, see the
92
+ # documentation.
93
+ #
94
+ # html_theme_options = {}
95
+
96
+ # Add any paths that contain custom static files (such as style sheets) here,
97
+ # relative to this directory. They are copied after the builtin static files,
98
+ # so a file named "default.css" will overwrite the builtin "default.css".
99
+ html_static_path = ["_static"]
100
+
101
+ # Custom sidebar templates, must be a dictionary that maps document names
102
+ # to template names.
103
+ #
104
+ # This is required for the alabaster theme
105
+ # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
106
+ html_sidebars = {
107
+ "**": [
108
+ "globaltoc.html", # needs 'show_related': True theme option to display
109
+ "searchbox.html",
110
+ ]
111
+ }
112
+
113
+
114
+ # -- Options for HTMLHelp output ------------------------------------------
115
+
116
+ # Output file base name for HTML help builder.
117
+ htmlhelp_basename = f"{project}doc"
118
+
119
+
120
+ # -- Options for LaTeX output ---------------------------------------------
121
+
122
+ latex_elements = {
123
+ # The paper size ('letterpaper' or 'a4paper').
124
+ #
125
+ # 'papersize': 'letterpaper',
126
+ # The font size ('10pt', '11pt' or '12pt').
127
+ #
128
+ # 'pointsize': '10pt',
129
+ # Additional stuff for the LaTeX preamble.
130
+ #
131
+ # 'preamble': '',
132
+ # Latex figure (float) alignment
133
+ #
134
+ # 'figure_align': 'htbp',
135
+ }
136
+
137
+ # Grouping the document tree into LaTeX files. List of tuples
138
+ # (source start file, target name, title,
139
+ # author, documentclass [howto, manual, or own class]).
140
+ latex_documents = [
141
+ (
142
+ master_doc,
143
+ f"{project}.tex",
144
+ f"{project} Documentation",
145
+ author,
146
+ "manual",
147
+ ),
148
+ ]
149
+
150
+
151
+ # -- Options for manual page output ---------------------------------------
152
+
153
+ # One entry per manual page. List of tuples
154
+ # (source start file, name, description, authors, manual section).
155
+ man_pages = [(master_doc, f"{project}", f"{project} Documentation", [author], 1)]
156
+
157
+
158
+ # -- Options for Texinfo output -------------------------------------------
159
+
160
+ # Grouping the document tree into Texinfo files. List of tuples
161
+ # (source start file, target name, title, author,
162
+ # dir menu entry, description, category)
163
+ texinfo_documents = [
164
+ (
165
+ master_doc,
166
+ f"{project}",
167
+ f"{project} Documentation",
168
+ author,
169
+ project,
170
+ "Shared pytest configuration and fixtures for Vivarium projects.",
171
+ "Miscellaneous",
172
+ ),
173
+ ]
174
+
175
+ # Other docs we can link to
176
+ intersphinx_mapping = {
177
+ "python": ("https://docs.python.org/3/", None),
178
+ "pandas": ("https://pandas.pydata.org/docs/", None),
179
+ "tables": ("https://www.pytables.org/", None),
180
+ "numpy": ("https://numpy.org/doc/stable/", None),
181
+ "networkx": ("https://networkx.org/documentation/stable/", None),
182
+ "vivarium_engine": ("https://vivarium-engine.readthedocs.io/en/latest/", None),
183
+ "vivarium_research": ("https://vivarium-research.readthedocs.io/en/latest/", None),
184
+ }
185
+
186
+
187
+ # -- Autodoc configuration ------------------------------------------------
188
+
189
+ autodoc_default_options = {
190
+ # Automatically document members (e.g. classes in a module,
191
+ # methods in a class, etc.)
192
+ "members": True,
193
+ # Order of items documented is determined by the order
194
+ # of appearance in the source code
195
+ "member-order": "bysource",
196
+ # Generate docs even if an item has no docstring.
197
+ "undoc-members": True,
198
+ # Don't document things with a leading underscore.
199
+ "private-members": False,
200
+ }
201
+ # Display type hints in the description instead of the signature.
202
+ autodoc_typehints = "description"
203
+
204
+
205
+ # -- nitpicky mode --------------------------------------------------------
206
+ # Ensures that all references in the docs resolve.
207
+
208
+ nitpicky = True
209
+
210
+ nitpick_ignore = []
211
+ for line in open("../nitpick-exceptions"):
212
+ if line.strip() == "" or line.startswith("#"):
213
+ continue
214
+ dtype, target = line.split(None, 1)
215
+ target = target.strip()
216
+ nitpick_ignore.append((dtype, target))
217
+
218
+
219
+ # Fix sphinx warnings when for literal Ellipses in type hints.
220
+ def setup(app):
221
+ app.connect("missing-reference", __sphinx_issue_8127)
222
+
223
+
224
+ def __sphinx_issue_8127(app, env, node, contnode):
225
+ reftarget = node.get("reftarget", None)
226
+ if reftarget == "..":
227
+ node["reftype"] = "data"
228
+ node["reftarget"] = "Ellipsis"
229
+ text_node = next(iter(contnode.traverse(lambda n: n.tagname == "#text")))
230
+ replacement_node = Text("...", "")
231
+ if text_node.parent is not None:
232
+ text_node.parent.replace(text_node, replacement_node)
233
+ else: # e.g. happens in rtype fields
234
+ contnode = replacement_node
235
+ return missing_reference(app, env, node, contnode)
@@ -0,0 +1,47 @@
1
+ ===============
2
+ pytest-vivarium
3
+ ===============
4
+
5
+ ``pytest-vivarium`` is a `pytest <https://docs.pytest.org/>`_ plugin providing the
6
+ shared test configuration used across the
7
+ `vivarium-suite <https://github.com/ihmeuw/vivarium-suite>`_ monorepo and the
8
+ Institute for Health Metrics and Evaluation's Simulation Science team's model
9
+ repositories. Installing it as a test dependency auto-registers everything below
10
+ via pytest's ``pytest11`` entry point - there is nothing to import.
11
+
12
+ Markers and options
13
+ --------------------
14
+
15
+ ``slow``
16
+ Mark a test as slow. Skipped unless ``--runslow`` is passed.
17
+
18
+ ``weekly``
19
+ Mark a test as part of the weekly suite. Skipped unless ``--runweekly`` is
20
+ passed or it is the designated slow-test day (Sunday).
21
+
22
+ ``cluster``
23
+ Mark a test as requiring a SLURM cluster. Skipped automatically when
24
+ ``sbatch`` is not on the ``PATH``. ``--slurm-project`` sets the SLURM project
25
+ (default ``proj_simscience``).
26
+
27
+ Bounded ``-n auto`` workers
28
+ ---------------------------
29
+
30
+ The plugin implements ``pytest_xdist_auto_num_workers`` so that ``pytest -n auto``
31
+ does not oversubscribe large shared nodes. The worker count targets a small
32
+ ceiling and is clamped to the process's usable CPUs and to the memory available
33
+ to it - reading both node free memory and any cgroup (for example a SLURM
34
+ ``--mem``) limit. The resolved plan is printed in the run header.
35
+
36
+ The ``no_gbd_cache`` fixture
37
+ ----------------------------
38
+
39
+ ``no_gbd_cache`` disables ``vivarium_gbd_access`` caching for test isolation. It
40
+ is not ``autouse``; wrap it in an ``autouse`` fixture in your own ``conftest.py``
41
+ to apply it broadly.
42
+
43
+ .. toctree::
44
+ :hidden:
45
+ :maxdepth: 2
46
+
47
+ self