Closed Bug 1706197 Opened 4 years ago Closed 4 years ago

incorrect line numbers in test_lint.py when testing on desktop

Categories

(Developer Infrastructure :: Lint and Formatting, task)

Tracking

(firefox90 fixed)

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: sfink, Assigned: sfink)

Details

Attachments

(1 file, 1 obsolete file)

python/mozbuild/mozbuild/test/configure/test_lint.py has two tests that look for an error on a specific line. They pass in automation, but break on my desktop because I'm running Python 3.9. The difference is tied to the Python version.

Python 3.6:

% python3.6 ./mach python python/mozbuild/mozbuild/test/configure/test_lint.py
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_configure_testcase PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_disable PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_enable PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_func PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_with PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_without PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_depends_failures PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_large_offset PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_undefined_global PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_unnecessary_imports PASSED

Python 3.9:

% python3.9 ./mach python python/mozbuild/mozbuild/test/configure/test_lint.py
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_configure_testcase PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_disable PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_enable PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_func FAILED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_with PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_default_without PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_depends_failures PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_large_offset FAILED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_undefined_global PASSED
python/mozbuild/mozbuild/test/configure/test_lint.py::TestLint::test_unnecessary_imports PASSED

============================================= FAILURES =============================================
____________________________________ TestLint.test_default_func ____________________________________
mozbuild.configure.ConfigureError: `help` should contain "{Enable|Disable}" because of non-constant default

During handling of the above exception, another exception occurred:

self = <test_lint.TestLint testMethod=test_default_func>

    def test_default_func(self):
        # Help text for an option with variable default should contain
        # {enable|disable} rule.
        with self.moz_configure(
            """
                option(env='FOO', help='foo')
                option('--enable-bar', default=depends('FOO')(lambda x: bool(x)),
                       help='{Enable|Disable} bar')
            """
        ):
            self.lint_test()
        with self.assertRaisesFromLine(ConfigureError, 4) as e:
            with self.moz_configure(
                """
                    option(env='FOO', help='foo')
                    option('--enable-bar', default=depends('FOO')(lambda x: bool(x)),
                           help='Enable bar')
                """
            ):
>               self.lint_test()

python/mozbuild/mozbuild/test/configure/test_lint.py:418: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.9/contextlib.py:135: in __exit__
    self.gen.throw(type, value, traceback)
python/mozbuild/mozbuild/test/configure/test_lint.py:45: in assertRaisesFromLine
    self.assertEquals(
E   AssertionError: Tuples differ: ('/ho[22 chars]python/mozbuild/mozbuild/test/configure/data/moz.configure', 3) != ('/ho[22 chars]python/mozbuild/mozbuild/test/configure/data/moz.configure', 4)
E   
E   First differing element 1:
E   3
E   4
E   
E     ('/home/sfink/src/mozilla3/python/mozbuild/mozbuild/test/configure/data/moz.configure',
E   -  3)
E   +  4)
____________________________________ TestLint.test_large_offset ____________________________________
mozbuild.configure.ConfigureError: `help` should contain "{Enable|Disable}" because of non-constant default

During handling of the above exception, another exception occurred:

self = <test_lint.TestLint testMethod=test_large_offset>

    def test_large_offset(self):
        with self.assertRaisesFromLine(ConfigureError, 376):
            with self.moz_configure(
                """
                    option(env='FOO', help='foo')
                """
                + "\n" * 371
                + """
                    option('--enable-bar', default=depends('FOO')(lambda x: bool(x)),
                           help='Enable bar')
                """
            ):
>               self.lint_test()

python/mozbuild/mozbuild/test/configure/test_lint.py:437: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib64/python3.9/contextlib.py:135: in __exit__
    self.gen.throw(type, value, traceback)
python/mozbuild/mozbuild/test/configure/test_lint.py:45: in assertRaisesFromLine
    self.assertEquals(
E   AssertionError: Tuples differ: ('/ho[24 chars]thon/mozbuild/mozbuild/test/configure/data/moz.configure', 375) != ('/ho[24 chars]thon/mozbuild/mozbuild/test/configure/data/moz.configure', 376)
E   
E   First differing element 1:
E   375
E   376
E   
E     ('/home/sfink/src/mozilla3/python/mozbuild/mozbuild/test/configure/data/moz.configure',
E   -  375)
E   ?    ^
E   
E   +  376)
E   ?    ^
================================ 2 failed, 8 passed in 0.12 seconds ================================
Assignee: nobody → sphink
Status: NEW → ASSIGNED
Assignee: nobody → sphink
Status: NEW → ASSIGNED
Attachment #9216941 - Attachment is obsolete: true
Pushed by sfink@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8cf80eeb4fee Avoid Python version dependent line number issues r=firefox-build-system-reviewers,glandium
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: