GeezerVison is showing github.com — Make sure filenames are not norm-cased on Windows. (#6856) · mitchell-as/vscode-python@d92460b
File treeExpand file treeCollapse file tree Open diff view settings testing_tools/adapter/pytest tests/testing_tools/adapter
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: build/ci/templates/test_phases.yml +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -231,7 +231,7 @@ steps: | 231 | 231 | # > python -m pip install -U -r build/test-requirements.txt | 232 | 232 | # > python pythonFiles/tests/run_all.py --color=yes --junit-xml=python-tests-junit.xml | 233 | 233 | - bash: | | 234 | | - python pythonFiles/tests/run_all.py --color=yes --junit-xml=$COMMON_TESTRESULTSDIRECTORY/python-tests-junit.xml | | 234 | + python pythonFiles/tests/run_all.py --color=no --junit-xml=$COMMON_TESTRESULTSDIRECTORY/python-tests-junit.xml | 235 | 235 | displayName: 'Python unittests' | 236 | 236 | condition: and(succeeded(), contains(variables['TestsToRun'], 'pythonUnitTests')) | 237 | 237 |
| @@ -256,7 +256,7 @@ steps: | 256 | 256 | # > python -m pip install -U -r build/test-requirements.txt | 257 | 257 | # > python pythonFiles/tests/run_all.py --color=yes --junit-xml=python-tests-junit.xml | 258 | 258 | - bash: | | 259 | | - python -m IPython pythonFiles/tests/run_all.py -- --color=yes --junit-xml=$COMMON_TESTRESULTSDIRECTORY/ipython-tests-junit.xml | | 259 | + python -m IPython pythonFiles/tests/run_all.py -- --color=no --junit-xml=$COMMON_TESTRESULTSDIRECTORY/ipython-tests-junit.xml | 260 | 260 | displayName: 'Python ipython tests' | 261 | 261 | condition: and(succeeded(), contains(variables['TestsToRun'], 'pythonIPythonTests')) | 262 | 262 |
| |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/testing_tools/adapter/pytest/_pytest_item.py +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -270,6 +270,7 @@ def _get_location(item, testroot, relfile, _normcase, _pathsep): | 270 | 270 |
| 271 | 271 | def _matches_relfile(srcfile, testroot, relfile, _normcase, _pathsep): | 272 | 272 | """Return True if "srcfile" matches the given relfile.""" | | 273 | + testroot = _normcase(testroot) | 273 | 274 | srcfile = _normcase(srcfile) | 274 | 275 | relfile = _normcase(relfile) | 275 | 276 | if srcfile == relfile: | |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/tests/testing_tools/adapter/.data/NormCase/tests/A/__init__.py Collapse file Copy file name to clipboardExpand all lines: pythonFiles/tests/testing_tools/adapter/.data/NormCase/tests/A/b/C/__init__.py Collapse file Copy file name to clipboard +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | + | | 2 | +def test_okay(): | | 3 | + assert True |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/tests/testing_tools/adapter/.data/NormCase/tests/A/b/__init__.py Collapse file Copy file name to clipboardExpand all lines: pythonFiles/tests/testing_tools/adapter/.data/NormCase/tests/__init__.py Collapse file Copy file name to clipboardExpand all lines: pythonFiles/tests/testing_tools/adapter/pytest/test_discovery.py +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -787,14 +787,14 @@ def test_windows(self): | 787 | 787 | stub = Stub() | 788 | 788 | discovered = StubDiscoveredTests(stub) | 789 | 789 | session = StubPytestSession(stub) | 790 | | - testroot = r'c:\a\b\c' | | 790 | + testroot = r'C:\A\B\C' | 791 | 791 | relfile = r'X\Y\Z\test_eggs.py' | 792 | 792 | session.items = [ | 793 | 793 | StubFunctionItem( | 794 | 794 | stub, | 795 | | - nodeid='X/Y/Z/test_eggs.py::SpamTests::test_spam', | | 795 | + nodeid='x/y/z/test_eggs.py::SpamTests::test_spam', | 796 | 796 | name='test_spam', | 797 | | - location=('x/y/z/test_eggs.py', 12, 'SpamTests.test_spam'), | | 797 | + location=('X/Y/Z/test_eggs.py', 12, 'SpamTests.test_spam'), | 798 | 798 | fspath=testroot + '\\' + relfile, | 799 | 799 | function=FakeFunc('test_spam'), | 800 | 800 | ), | @@ -825,12 +825,12 @@ def normcase(path): | 825 | 825 | id=r'.\x\y\z\test_eggs.py::SpamTests::test_spam', | 826 | 826 | name='test_spam', | 827 | 827 | path=TestPath( | 828 | | - root=testroot, | 829 | | - relfile=r'.\X\Y\Z\test_eggs.py', | | 828 | + root=testroot, # not normalized | | 829 | + relfile=r'.\X\Y\Z\test_eggs.py', # not normalized | 830 | 830 | func='SpamTests.test_spam', | 831 | 831 | sub=None, | 832 | 832 | ), | 833 | | - source=r'.\X\Y\Z\test_eggs.py:{}'.format(13), | | 833 | + source=r'.\X\Y\Z\test_eggs.py:{}'.format(13), # not normalized | 834 | 834 | markers=None, | 835 | 835 | parentid=r'.\x\y\z\test_eggs.py::SpamTests', | 836 | 836 | ), | |
Collapse file Copy file name to clipboardExpand all lines: pythonFiles/tests/testing_tools/adapter/test_functional.py +52-2Lines changed: 52 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 21 | 21 |
| 22 | 22 |
| 23 | 23 | def resolve_testroot(name): | 24 | | - projroot = os.path.normcase( | 25 | | - os.path.join(DATA_DIR, name)) | | 24 | + projroot = os.path.join(DATA_DIR, name) | 26 | 25 | return projroot, os.path.join(projroot, 'tests') | 27 | 26 |
| 28 | 27 |
| @@ -256,6 +255,57 @@ def test_discover_syntax_error(self): | 256 | 255 | ) | 257 | 256 | self.assertIn('(exit code 2)', cm.exception.output) | 258 | 257 |
| | 258 | + def test_discover_normcase(self): | | 259 | + projroot, testroot = resolve_testroot('NormCase') | | 260 | + | | 261 | + out = run_adapter('discover', 'pytest', | | 262 | + '--rootdir', projroot, | | 263 | + testroot) | | 264 | + result = json.loads(out) | | 265 | + | | 266 | + self.maxDiff = None | | 267 | + self.assertTrue(projroot.endswith('NormCase')) | | 268 | + fix_id = os.path.normcase | | 269 | + self.assertEqual(result, [{ | | 270 | + 'root': projroot, | | 271 | + 'rootid': '.', | | 272 | + 'parents': [ | | 273 | + {'id': fix_id('./tests'), | | 274 | + 'kind': 'folder', | | 275 | + 'name': 'tests', | | 276 | + 'parentid': '.', | | 277 | + }, | | 278 | + {'id': fix_id('./tests/A'), | | 279 | + 'kind': 'folder', | | 280 | + 'name': fix_id('A'), | | 281 | + 'parentid': fix_id('./tests'), | | 282 | + }, | | 283 | + {'id': fix_id('./tests/A/b'), | | 284 | + 'kind': 'folder', | | 285 | + 'name': 'b', | | 286 | + 'parentid': fix_id('./tests/A'), | | 287 | + }, | | 288 | + {'id': fix_id('./tests/A/b/C'), | | 289 | + 'kind': 'folder', | | 290 | + 'name': fix_id('C'), | | 291 | + 'parentid': fix_id('./tests/A/b'), | | 292 | + }, | | 293 | + {'id': fix_id('./tests/A/b/C/test_Spam.py'), | | 294 | + 'kind': 'file', | | 295 | + 'name': fix_id('test_Spam.py'), | | 296 | + 'parentid': fix_id('./tests/A/b/C'), | | 297 | + }, | | 298 | + ], | | 299 | + 'tests': [ | | 300 | + {'id': fix_id('./tests/A/b/C/test_Spam.py::test_okay'), | | 301 | + 'name': 'test_okay', | | 302 | + 'source': fix_path('./tests/A/b/C/test_Spam.py:2'), | | 303 | + 'markers': [], | | 304 | + 'parentid': fix_id('./tests/A/b/C/test_Spam.py'), | | 305 | + }, | | 306 | + ], | | 307 | + }]) | | 308 | + | 259 | 309 |
| 260 | 310 | COMPLEX = { | 261 | 311 | 'root': None, | |
|