Anonymous avatar Anonymous committed 3c6a259

Allow custom arg command line in BaseConfig constructor

Comments (0)

Files changed (2)

mozharness/base/config.py

     """
     def __init__(self, config=None, initial_config_file=None, config_options=None,
                  all_actions=None, default_actions=None,
-                 volatile_config=None,
+                 volatile_config=None, args=None,
                  require_config_file=False, usage="usage: %prog [options]"):
         self._config = {}
         self.actions = []
         if config_options is None:
             config_options = []
         self._create_config_parser(config_options, usage)
-        self.parse_args()
+        self.parse_args(args=args)
 
     def get_read_only_config(self):
         return ReadOnlyDict(self._config)
         child objects can manipulate it.
         """
         self.command_line = ' '.join(sys.argv)
-        if not args:
+        if args is None:
             args = sys.argv[1:]
         (options, args) = self.config_parser.parse_args(args)
 

mozharness/mozilla/testing/testbase.py

                                     os.path.join(dirs['abs_work_dir'], 'tests'))
         tree_config_path = os.path.join(test_install_dir, 'config', 'mozharness_config.py')
         if os.path.isfile(tree_config_path):
-            rw_config = BaseConfig(config=self.config.copy())
+            rw_config = BaseConfig(config=self.config.copy(), args=[])
             rw_config.set_config(parse_config_file(tree_config_path))
             self.config = rw_config.get_read_only_config()
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.