Closed Bug 1714159 Opened 3 years ago Closed 3 years ago

`mach lint` does not normalize drive letter case on Windows, leading to `test_black.py` failures

Categories

(Developer Infrastructure :: Lint and Formatting, defect)

defect

Tracking

(firefox91 fixed)

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: nalexander, Assigned: nalexander)

Details

Attachments

(1 file)

While investigating Bug 1713683, I ran across the following situation:

-*- mode: mach-process; default-directory: "c:/Users/nalexander/Mozilla/gecko/" -*-
mach-Process started at Wed Jun  2 10:55:29

env PYTHONIOENCODING=utf-8 MOZCONFIG=c:/Users/nalexander/Mozilla/mozconfig-gecko-win64-artifact MOZ_BUILD_APP=browser ./mach test --headless c:/Users/nalexander/Mozilla/gecko/tools/lint/test/test_black.py
c:\Users\nalexander\Mozilla\gecko\tools\lint\test\test_black.py
============================= test session starts =============================
platform win32 -- Python 3.7.4, pytest-3.6.2, py-1.10.0, pluggy-0.6.0 -- c:\Users\nalexander\Mozilla\objdirs\objdir-gecko-browser-win64-artifact\_virtualenvs\python-test\Scripts\python.exe
rootdir: c:\Users\nalexander\Mozilla\gecko, inifile: c:\Users\nalexander\Mozilla\gecko\config\mozunit\mozunit\pytest.ini
collecting ... collected 2 items

tools/lint/test/test_black.py::test_lint_fix[black] PASSED
tools/lint/test/test_black.py::test_lint_black[black] TEST-UNEXPECTED-FAIL

================================== FAILURES ===================================
___________________________ test_lint_black[black] ____________________________

lint = <function lint.<locals>.wrapper at 0x00000178FB5FC048>
paths = <function paths.<locals>._inner at 0x00000178FB5FC0D8>

    def test_lint_black(lint, paths):
        results = lint(paths())
        assert len(results) == 2

        assert results[0].level == "error"
>       assert results[0].relpath == "bad.py"
E       AssertionError: assert 'C:/Users/nal.../black/bad.py' == 'bad.py'
E         - C:/Users/nalexander/Mozilla/gecko/tools/lint/test/files/black/bad.py
E         + bad.py

tools\lint\test\test_black.py:45: AssertionError
---------------------------- Captured stderr setup ----------------------------
10:55:36.580 black (11596) | Looking for black at c:/Users/nalexander/Mozilla/objdirs/objdir-gecko-browser-win64-artifact/_virtualenvs/python-test/Scripts/black.EXE
10:55:37.2 black (11596) | Black is present with expected version 20.8b1
----------------------------- Captured log setup ------------------------------
black.py                   121 DEBUG    Looking for black at c:/Users/nalexander/Mozilla/objdirs/objdir-gecko-browser-win64-artifact/_virtualenvs/python-test/Scripts/black.EXE
black.py                   129 DEBUG    Black is present with expected version 20.8b1
---------------------------- Captured stderr call -----------------------------
10:55:37.408 black (11596) | Black version 20.8b1
10:55:37.408 black (11596) | Command: c:\Users\nalexander\Mozilla\objdirs\objdir-gecko-browser-win64-artifact\_virtualenvs\python-test\Scripts\black --check c:/Users/nalexander/Mozilla/gecko/tools/lint/test/files/black\bad.py c:/Users/nalexander/Mozilla/gecko/tools/lint/test/files/black\invalid.py
------------------------------ Captured log call ------------------------------
black.py                   147 DEBUG    Black version 20.8b1
black.py                   154 DEBUG    Command: c:\Users\nalexander\Mozilla\objdirs\objdir-gecko-browser-win64-artifact\_virtualenvs\python-test\Scripts\black --check c:/Users/nalexander/Mozilla/gecko/tools/lint/test/files/black\bad.py c:/Users/nalexander/Mozilla/gecko/tools/lint/test/files/black\invalid.py
===================== 1 failed, 1 passed in 5.05 seconds ======================
Setting retcode to 1 from c:\Users\nalexander\Mozilla\gecko\tools\lint\test\test_black.py
Return code from mach python-test: 1
 0:07.73 
Overall Summary
===============

mach-Process exited abnormally with code 1 at Wed Jun  2 10:55:40

What is happening is that the drive in one path is c:/ and in the other it's C:/. We shouldn't be looking for a prefix here.

Assignee: nobody → nalexander
Status: NEW → ASSIGNED
Pushed by nalexander@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dc9ce97e63e6
Handle `c:/...` and `C:/...` when making relative paths in `mozlint`. r=ahal
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 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: