tor-browser

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

update.py (1981B)


      1 # mypy: allow-untyped-defs
      2 
      3 import os
      4 import sys
      5 
      6 from mozlog import commandline
      7 
      8 wpt_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
      9 sys.path.insert(0, os.path.abspath(os.path.join(wpt_root, "tools")))
     10 
     11 
     12 def manifest_update(test_paths):
     13    from manifest import manifest  # type: ignore
     14    for url_base, paths in test_paths.items():
     15        manifest.load_and_update(
     16            paths.tests_path,
     17            paths.manifest_path,
     18            url_base)
     19 
     20 
     21 def create_parser_update():
     22    from wptrunner import wptcommandline
     23 
     24    return wptcommandline.create_parser_metadata_update()
     25 
     26 
     27 def update_expectations(_, **kwargs):
     28    from wptrunner import metadata, wptcommandline
     29 
     30    commandline.setup_logging("web-platform-tests",
     31                              kwargs,
     32                              {"mach": sys.stdout},
     33                              formatter_defaults=None)
     34 
     35    if not kwargs["tests_root"]:
     36        kwargs["tests_root"] = wpt_root
     37 
     38    # This matches the manifest path we end up using in `wpt run`
     39    if not kwargs["manifest_path"]:
     40        kwargs["manifest_path"] = os.path.join(wpt_root, "MANIFEST.json")
     41 
     42    kwargs = wptcommandline.check_args_metadata_update(kwargs)
     43 
     44    update_properties = metadata.get_properties(properties_file=kwargs["properties_file"],
     45                                                extra_properties=kwargs["extra_property"],
     46                                                product=kwargs["product"])
     47 
     48    manifest_update(kwargs["test_paths"])
     49    metadata.update_expected(kwargs["test_paths"],
     50                             kwargs["run_log"],
     51                             update_properties=update_properties,
     52                             full_update=False,
     53                             disable_intermittent=kwargs["update_intermittent"],
     54                             update_intermittent=kwargs["update_intermittent"],
     55                             remove_intermittent=kwargs["update_intermittent"])