Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tests_require to special "tests" extra for easier installation #1830

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 17 additions & 4 deletions doc/source/dev_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,33 @@ clone your fork. The package can then be installed in development mode by doing:
The first command will install all dependencies needed by the Satpy
conda-forge package, but won't actually install Satpy. The second command
should be run from the root of the cloned Satpy repository (where the
`setup.py` is) and will install the actual package.
``setup.py`` is) and will install the actual package.

You can now edit the python files in your cloned repository and have them
immediately reflected in your conda environment.

Running tests
=============

Satpy tests are written using the python :mod:`unittest` module and the
third-party :doc:`pytest <pytest:index>` package. Satpy tests can be executed by
running::
Satpy tests are written using the third-party :doc:`pytest <pytest:index>`
package. There is usually no need to run all Satpy tests, but instead only
run the tests related to the component you are working on. All tests are
automatically run from the GitHub Pull Request using multiple versions of
Python, multiple operating systems, and multiple versions of dependency
libraries. If you want to run all Satpy tests you will need to install
additional dependencies that aren't needed for regular Satpy usage. To install
them run::

pip install -e .[tests]

Satpy tests can be executed by running::

pytest satpy/tests

You can also run a specific tests by specifying a sub-directory or module::

pytest satpy/tests/reader_tests/test_abi_l1b.py

Running benchmarks
==================

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", 'setuptools_scm_git_archive']
requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2", 'setuptools_scm_git_archive']
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "satpy/version.py"
9 changes: 8 additions & 1 deletion satpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
"""Satpy Package initializer."""

import os
from satpy.version import version as __version__ # noqa

try:
from satpy.version import version as __version__ # noqa
except ModuleNotFoundError:
raise ModuleNotFoundError(
"No module named satpy.version. This could mean "
"you didn't install 'satpy' properly. Try reinstalling ('pip "
"install').")

CHUNK_SIZE = int(os.getenv('PYTROLL_CHUNK_SIZE', 4096))

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
# Other
'geoviews': ['geoviews'],
'overlays': ['pycoast', 'pydecorate'],
'tests': test_requires,
}
all_extras = []
for extra_deps in extras_require.values():
Expand Down Expand Up @@ -154,7 +155,6 @@ def _config_data_files(base_dirs, extensions=(".cfg", )):
use_scm_version={'write_to': 'satpy/version.py'},
setup_requires=['setuptools_scm', 'setuptools_scm_git_archive'],
install_requires=requires,
tests_require=test_requires,
python_requires='>=3.7',
extras_require=extras_require,
entry_points=entry_points,
Expand Down