lib: set version.TESTING based on if the unittest module is loaded
This is cleaner than needing to set an environment variable before running unit tests. Implements #28 (Check if unittest is loaded to determine if we are testing) Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
2daefa932c
commit
10c5fd4cef
2
Makefile
2
Makefile
|
@ -37,4 +37,4 @@ pkgbuild:
|
|||
.PHONY: tests
|
||||
tests:
|
||||
python tools/generate_tracks.py
|
||||
EMMENTAL_TESTING=1 python -m unittest discover -v
|
||||
python -m unittest discover -v
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
import os
|
||||
import sys
|
||||
|
||||
MAJOR = 2
|
||||
MINOR = 9
|
||||
|
@ -10,7 +11,7 @@ if os.path.exists(".debug"):
|
|||
if f.read().strip() == "emmental":
|
||||
DEBUG = True
|
||||
|
||||
TESTING = os.environ.get("EMMENTAL_TESTING") != None
|
||||
TESTING = "unittest" in sys.modules
|
||||
|
||||
|
||||
def string():
|
||||
|
|
Loading…
Reference in New Issue