Closed Bug 1595147 Opened 5 years ago Closed 5 years ago

NameError: name 'distro' is not defined when running jstests on linux

Categories

(Testing :: Mozbase, defect, P3)

defect

Tracking

(firefox-esr68 unaffected, firefox70 unaffected, firefox71 unaffected, firefox72 fixed)

RESOLVED FIXED
mozilla72
Tracking Status
firefox-esr68 --- unaffected
firefox70 --- unaffected
firefox71 --- unaffected
firefox72 --- fixed

People

(Reporter: jonco, Assigned: egao)

References

(Regression)

Details

(Keywords: regression)

I get the following error when trying to run jstests on the JS shell. This seems to be caused by changes to testing/mozbase/mozinfo/mozinfo/mozinfo.py in bug 1212502.

Traceback (most recent call last):
  File "tests/jstests.py", line 584, in <module>
    sys.exit(main())
  File "tests/jstests.py", line 545, in main
    test_count, test_gen = load_tests(options, requested_paths, excluded_paths)
  File "tests/jstests.py", line 466, in load_tests
    excluded_paths)
  File "tests/jstests.py", line 381, in load_wpt_tests
    run_info_extras = products.load_product(kwargs["config"], "firefox")[-1](**kwargs)
  File "/home/jon/clone/bug/testing/web-platform/tests/tools/wptrunner/wptrunner/products.py", line 53, in load_product
    rv = Product(config, product)
  File "/home/jon/clone/bug/testing/web-platform/tests/tools/wptrunner/wptrunner/products.py", line 33, in __init__
    module = product_module(config, product)
  File "/home/jon/clone/bug/testing/web-platform/tests/tools/wptrunner/wptrunner/products.py", line 23, in product_module
    module = importlib.import_module("wptrunner.browsers." + product)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/jon/clone/bug/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py", line 8, in <module>
    import mozinfo
  File "/home/jon/clone/bug/testing/mozbase/mozinfo/mozinfo/__init__.py", line 57, in <module>
    from . import mozinfo
  File "/home/jon/clone/bug/testing/mozbase/mozinfo/mozinfo/mozinfo.py", line 110, in <module>
    if hasattr(distro, "linux_distribution"):
NameError: name 'distro' is not defined

I found that either installing distro or pip install mozinfo (if not already installed in your current environment) or pip install -U mozinfo (if already installed using pip in your environment) resolved any missing dependencies for me.

Please note that mozinfo version was bumped to 1.2.0 on pypi so the upgrade flag should pick it up.

I can't get a non-artifact build running on my debian 10 VM, so I can't test if jstests does something unexpected.

On my local macosx1014 machine, when I run ./mach jstests it doesn't seem to create a virutalenv for subsequent commands to be run inside. That might explain why the exception is thrown.

I've filed bug 1595220 and put up a patch there that should streamline how mozinfo detects Linux distributions.

The change should also suppress this exception as long as user is using python <= 3.7 (where platform.linux_distribution() call exists).

See Also: → 1595220
Priority: -- → P3

:jonco - once you pull the newer mozilla-central, could you please confirm if that fixes the issue?

Flags: needinfo?(jcoppeard)
Version: Version 3 → unspecified

This is working again now. Thanks for fixing.

Flags: needinfo?(jcoppeard)
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Assignee: nobody → egao
Depends on: 1595220
Target Milestone: --- → mozilla72
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.