forked from spacetelescope/crds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests
executable file
·39 lines (31 loc) · 1.68 KB
/
runtests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#! /usr/bin/env python
import sys
import os
import os.path
import crds
from crds import config, log
os.chdir(os.path.dirname(sys.argv[0]) or ".")
topdir = os.getcwd()
CRDS_TEST_ROOT = os.environ.get("CRDS_TEST_ROOT", os.environ["HOME"])
# Unlike historical CRDS with builtin cache, test cache is now a separate dedicated entity
# which contains mutated but otherwise same named mutated files.
# os.environ["CRDS_MAPPATH"] = os.path.join(os.getcwd(), "..", "crds_cache_archive", "mappings")
os.environ["CRDS_TESTING_CACHE"] = os.path.join(CRDS_TEST_ROOT, "crds-cache-test")
# The *defined* CRDS cache for testing
os.environ["CRDS_PATH"] = os.path.join(CRDS_TEST_ROOT, "crds-cache-default-test")
# For testing, even the default cache is controlled and overridden. This is a test-only setting,
# ordinarily the cache is controlled by CRDS_PATH, etc. This controls where files are found if
# 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))
elif "--cover" in sys.argv:
status = os.system("nosetests --with-coverage --cover-branches --cover-package=crds".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))
else:
status = os.system("nosetests")
os.system("python -m crds.list --status --log-time")
sys.exit(status)