tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

python_test.py (1513B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 """
      5 Support for running mach python-test tasks (via run-task)
      6 """
      7 
      8 from taskgraph.util.schema import Schema
      9 from voluptuous import Any, Optional, Required
     10 
     11 from gecko_taskgraph.transforms.job import configure_taskdesc_for_run, run_job_using
     12 
     13 python_test_schema = Schema({
     14    Required("using"): "python-test",
     15    # The subsuite to run
     16    Required("subsuite"): str,
     17    # Base work directory used to set up the task.
     18    Optional("workdir"): str,
     19    # Use the specified caches.
     20    Optional("use-caches"): Any(bool, [str]),
     21    # Prepend the specified ENV variables to the command. This can be useful
     22    # if the value of the ENV needs to be interpolated with another ENV.
     23    Optional("prepend-env"): {str: str},
     24 })
     25 
     26 
     27 defaults = {
     28    "subsuite": "default",
     29 }
     30 
     31 
     32 @run_job_using(
     33    "docker-worker", "python-test", schema=python_test_schema, defaults=defaults
     34 )
     35 @run_job_using(
     36    "generic-worker", "python-test", schema=python_test_schema, defaults=defaults
     37 )
     38 def configure_python_test(config, job, taskdesc):
     39    run = job["run"]
     40    worker = job["worker"]
     41 
     42    # defer to the mach implementation
     43    run["mach"] = ("python-test --subsuite {subsuite} --run-slow").format(**run)
     44    run["using"] = "mach"
     45    del run["subsuite"]
     46    configure_taskdesc_for_run(config, job, taskdesc, worker["implementation"])