diff --git a/testing/mozharness/mozharness/mozilla/testing/talos.py b/testing/mozharness/mozharness/mozilla/testing/talos.py index 7fa638ed18f6..9926b2c289dc 100755 --- a/testing/mozharness/mozharness/mozilla/testing/talos.py +++ b/testing/mozharness/mozharness/mozilla/testing/talos.py @@ -584,6 +584,27 @@ class Talos(TestingMixin, MercurialScript, BlobUploadMixin, TooltoolMixin, """VirtualenvMixin.create_virtualenv() assuemes we're using self.config['virtualenv_modules']. Since we are installing talos from its source, we have to wrap that method here.""" + # if virtualenv already exists, just add to path and don't re-install, need it + # in path so can import jsonschema later when validating output for perfherder + _virtualenv_path = self.config.get("virtualenv_path") + + if self.run_local and os.path.exists(_virtualenv_path): + self.info("Virtualenv already exists, skipping creation") + _python_interp = self.config.get('exes')['python'] + + if 'win' in self.platform_name(): + _path = os.path.join(_virtualenv_path, + 'Lib', + 'site-packages') + else: + _path = os.path.join(_virtualenv_path, + 'lib', + os.path.basename(_python_interp), + 'site-packages') + sys.path.append(_path) + return + + # virtualenv doesn't already exist so create it # install mozbase first, so we use in-tree versions if not self.run_local: mozbase_requirements = os.path.join( @@ -612,8 +633,6 @@ class Talos(TestingMixin, MercurialScript, BlobUploadMixin, TooltoolMixin, requirements=[os.path.join(self.talos_path, 'requirements.txt')] ) - # install jsonschema for perfherder validation - self.install_module(module="jsonschema") def _validate_treeherder_data(self, parser): # late import is required, because install is done in create_virtualenv diff --git a/testing/talos/mach_commands.py b/testing/talos/mach_commands.py index a9cd8b6c0125..3220df4eb1ad 100644 --- a/testing/talos/mach_commands.py +++ b/testing/talos/mach_commands.py @@ -49,9 +49,8 @@ class TalosRunner(MozbuildObject): def make_config(self): default_actions = ['populate-webroot'] - if not os.path.exists(self.virtualenv_path): - default_actions.append('create-virtualenv') default_actions.extend([ + 'create-virtualenv', 'setup-mitmproxy', 'run-tests', ])