diff --git a/ietf/tests.py b/ietf/tests.py index a9dd1a3d5..dd0d10652 100644 --- a/ietf/tests.py +++ b/ietf/tests.py @@ -107,6 +107,9 @@ class UrlTestCase(TestCase): from django.test.client import Client self.client = Client() + # get selected prefixes, if any + self.prefixes = os.environ.get("URLPREFIX", "").split() + # find test urls self.testtuples = [] self.testurls = [] @@ -133,6 +136,11 @@ class UrlTestCase(TestCase): # extract application urls: self.patterns = get_patterns(ietf.urls) + + # apply prefix filters + self.patterns = [ pattern for pattern in self.patterns for prefix in self.prefixes if re.match(prefix, pattern) ] + self.testtuples = [ tuple for tuple in self.testtuples for prefix in self.prefixes if re.match(prefix, tuple[1][1:]) ] + # Use the default database for the url tests, instead of the test database self.testdb = settings.DATABASE_NAME connection.close() diff --git a/test/run b/test/run index 2331a7615..05ebc96f0 100755 --- a/test/run +++ b/test/run @@ -13,7 +13,7 @@ test/run-pyflakes ietf trap 'echo "$program($LINENO): Caught Interrupt"' INT # run tests with our patched django -PYTHONPATH=test:test/lib python ietf/manage.py test +PYTHONPATH=test:test/lib URLPREFIX="$*" python ietf/manage.py test # reset keyboard interrupt trap trap INT