ext: Remove dead code from loader.py
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 11 Jun 2020 12:43:43 +0000 (13:43 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 18 Jun 2020 14:28:14 +0000 (14:28 +0000)
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 <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30236
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
ext/testlib/loader.py

index bb2fe4ef929e173e93ea4282e480050ae73216a3..2d7699684668cc7d845a319e8fbd1dbc5b987b54 100644 (file)
@@ -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)