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

pytest/run-pytests-action #957

Merged
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
name: CI

on:
push:
branches:
- master
tags:
- '*'
## uncomment before merging to master once test suite is finalized
# push:
# branches:
# - master
# tags:
# - '*'
pull_request:
branches:
- master
# - master
- pytest-migration #temp

jobs:
pytest:
Expand All @@ -23,9 +25,11 @@ jobs:
matrix:
runs-on:
- ubuntu-latest
- macos-latest
# - macos-latest # TEMP
python-version:
- 3.9
- '3.10'
- 3.11
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
coverage
.coverage
coverage.*
.profile-stats
.pydevproject
.project
*.pyc
Expand Down
6 changes: 6 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ def jwst_test_cache_state(test_cache):
cfg = ConfigState(cache=test_cache, observatory="jwst")
cfg.config_setup()
return cfg

@fixture(scope='function')
def roman_test_cache_state(test_cache):
cfg = ConfigState(cache=test_cache, url="https://roman-serverless-mode.stsci.edu", observatory="roman")
cfg.config_setup()
return cfg

# ==============================================================================

Expand Down
6 changes: 3 additions & 3 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ st=$st$?
# to install CRDS from source code. To support testing the
# setup_test_cache script should also be run to install other test files.
if [ $dev_install = 0 ]; then
echo "Setup data..."
python setup_data.py install --force >>install.log
st=$st$?
# echo "Setup data..."
# python setup_data.py install --force >>install.log
# st=$st$?

if (test -e clean)
then
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,19 @@ homepage = "https://github.com/spacetelescope/crds"
jwst = ["jwst"]
roman = ["roman_datamodels"]
submission = ["requests", "lxml", "parsley"]
dev = ["ipython", "jupyterlab", "ansible", "helm", "nose-cprof", "coverage"]
dev = ["ipython", "jupyterlab", "ansible", "helm"]
test = [
"lockfile",
"mock",
"nose",
"pytest",
"pylint",
"flake8",
"bandit",
"coverage",
"metrics-logger",
"pytest >= 6.0",
"pytest-astropy",
"pytest-doctestplus>=0.10.0",
"pytest-cov",
"pytest-profiling",
]
docs = [
"sphinx",
Expand Down
11 changes: 5 additions & 6 deletions runtests
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ os.environ["CRDS_PATH"] = os.path.join(CRDS_TEST_ROOT, "crds-cache-default-test"
# the normal mechanisms for defining the cache are *not* used. It is not intended to replace them.
os.environ["CRDS_DEFAULT_CACHE"] = os.environ["CRDS_PATH"]

# os.system("./install")
# os.system("./setup_test_cache")

if "--cover-html" in sys.argv:
status = os.system("nosetests --with-coverage --cover-html --cover-html-dir={0}/coverage --cover-branches --cover-package=crds --cover-erase".format(topdir))
status = os.system("pytest --cov=crds --cov-report=html".format(topdir))
elif "--cover" in sys.argv:
status = os.system("nosetests --with-coverage --cover-branches --cover-package=crds".format(topdir))
status = os.system("pytest --cov=crds --cov-report=xml".format(topdir))
elif "--profile" in sys.argv:
status = os.system("nosetests --with-cprofile --cprofile-stats-file={0}/runtests.profile.stats --cprofile-stats-erase".format(topdir))
status = os.system("pytest --profile --pstats-dir={0}/.profile-stats".format(topdir))
else:
status = os.system("nosetests")
status = os.system("pytest")
os.system("python -m crds.list --status --log-time")
sys.exit(os.WEXITSTATUS(status))
9 changes: 4 additions & 5 deletions setup_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
setup_pars = {
"packages": [
"crds",
"crds.tests",
],
"package_dir": {
"crds": "crds",
"crds.tests": "crds/tests",
"test": "test",
},
"package_data": {
"crds.tests": [
"test": [
"data/*",
],
},
Expand All @@ -25,7 +24,7 @@
setup(
name="crds_test_data",
provides=[
"crds.tests.data",
"test.data",
],
version=crds.__version__,
description="Calibration Reference Data System, HST/JWST reference file management (test data)",
Expand All @@ -44,4 +43,4 @@
"Topic :: Scientific/Engineering :: Astronomy",
],
**setup_pars
)
)
Loading