From: Giacomo Travaglini Date: Thu, 11 Jun 2020 12:43:43 +0000 (+0100) Subject: ext: Remove dead code from loader.py X-Git-Tag: v20.1.0.0~573 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=06b6767bbe7890a0840eddd07ac5aaf638d9f3fe;p=gem5.git ext: Remove dead code from loader.py This has been tested with vulture: https://pypi.org/project/vulture JIRA: https://gem5.atlassian.net/projects/GEM5/issues/GEM5-533 Change-Id: I4193eff3ea4194f793547767a47c3ac5a64813fd Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30236 Maintainer: Bobby R. Bruce Tested-by: kokoro Reviewed-by: Hoa Nguyen --- diff --git a/ext/testlib/loader.py b/ext/testlib/loader.py index bb2fe4ef9..2d7699684 100644 --- a/ext/testlib/loader.py +++ b/ext/testlib/loader.py @@ -71,7 +71,6 @@ import six import sys import traceback -import testlib.configuration as configuration import testlib.log as log import testlib.suite as suite_mod import testlib.test_util as test_mod @@ -183,9 +182,6 @@ class Loader(object): Load files from the given root directory which match `self.filepath_filter`. ''' - if __debug__: - self._loaded_a_file = True - for directory in self._discover_files(root): directory = list(directory) if directory: @@ -193,13 +189,6 @@ class Loader(object): for f in directory: self.load_file(f) - def load_dir(self, directory): - for dir_ in self._discover_files(directory): - directory = list(directory) - _assert_files_in_same_dir(dir_) - for f in dir_: - self.load_file(f) - def load_file(self, path): path = os.path.abspath(path) @@ -224,7 +213,6 @@ class Loader(object): sys.path.insert(0, os.path.dirname(path)) cwd = os.getcwd() os.chdir(os.path.dirname(path)) - configuration.config.file_under_load = path new_tests = test_mod.TestCase.collector.create() new_suites = suite_mod.TestSuite.collector.create() @@ -239,7 +227,6 @@ class Loader(object): 'Ignoring all tests in this file.' % (path)) # Clean up - configuration.config.file_under_load = None sys.path[:] = old_path os.chdir(cwd) test_mod.TestCase.collector.remove(new_tests) @@ -283,7 +270,6 @@ class Loader(object): self.suite_uids.update({suite.uid: suite for suite in loaded_suites}) # Clean up - configuration.config.file_under_load = None sys.path[:] = old_path os.chdir(cwd) test_mod.TestCase.collector.remove(new_tests)