From 7779d030b8104c2b62a91d6e6fe421f454706b6d Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler Date: Mon, 5 Sep 2022 16:17:31 +0200 Subject: [PATCH] Add pytest.oggm wrapper This is a workaround for https://github.com/pytest-dev/pytest/issues/1596 Without this, testing an installed version of oggm is impossible. --- oggm/tests/__main__.py | 13 +++++++++++++ setup.cfg | 1 + 2 files changed, 14 insertions(+) create mode 100644 oggm/tests/__main__.py diff --git a/oggm/tests/__main__.py b/oggm/tests/__main__.py new file mode 100644 index 000000000..52edc3f7e --- /dev/null +++ b/oggm/tests/__main__.py @@ -0,0 +1,13 @@ +import os +import sys + +HERE = os.path.dirname(__file__) + + +def main(): + import pytest + return pytest.main([HERE] + sys.argv[1:]) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/setup.cfg b/setup.cfg index 9a5a59d5e..742f78d37 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,3 +51,4 @@ console_scripts = oggm_prepro = oggm.cli.prepro_levels:main oggm_benchmark = oggm.cli.benchmark:main oggm_netrc_credentials = oggm.cli.netrc_credentials:cli + pytest.oggm = oggm.tests.__main__:main