Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/ci/templates/test_phases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ steps:
# > python -m pip install -U -r build/test-requirements.txt
# > python pythonFiles/tests/run_all.py --color=yes --junit-xml=python-tests-junit.xml
- bash: |
python pythonFiles/tests/run_all.py --color=yes --junit-xml=$COMMON_TESTRESULTSDIRECTORY/python-tests-junit.xml
python pythonFiles/tests/run_all.py --color=no --junit-xml=$COMMON_TESTRESULTSDIRECTORY/python-tests-junit.xml
displayName: 'Python unittests'
condition: and(succeeded(), contains(variables['TestsToRun'], 'pythonUnitTests'))

Expand All @@ -256,7 +256,7 @@ steps:
# > python -m pip install -U -r build/test-requirements.txt
# > python pythonFiles/tests/run_all.py --color=yes --junit-xml=python-tests-junit.xml
- bash: |
python -m IPython pythonFiles/tests/run_all.py -- --color=yes --junit-xml=$COMMON_TESTRESULTSDIRECTORY/ipython-tests-junit.xml
python -m IPython pythonFiles/tests/run_all.py -- --color=no --junit-xml=$COMMON_TESTRESULTSDIRECTORY/ipython-tests-junit.xml
displayName: 'Python ipython tests'
condition: and(succeeded(), contains(variables['TestsToRun'], 'pythonIPythonTests'))

Expand Down
1 change: 1 addition & 0 deletions pythonFiles/testing_tools/adapter/pytest/_pytest_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def _get_location(item, testroot, relfile, _normcase, _pathsep):

def _matches_relfile(srcfile, testroot, relfile, _normcase, _pathsep):
"""Return True if "srcfile" matches the given relfile."""
testroot = _normcase(testroot)
srcfile = _normcase(srcfile)
relfile = _normcase(relfile)
if srcfile == relfile:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

def test_okay():
assert True
Empty file.
12 changes: 6 additions & 6 deletions pythonFiles/tests/testing_tools/adapter/pytest/test_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,14 +787,14 @@ def test_windows(self):
stub = Stub()
discovered = StubDiscoveredTests(stub)
session = StubPytestSession(stub)
testroot = r'c:\a\b\c'
testroot = r'C:\A\B\C'
relfile = r'X\Y\Z\test_eggs.py'
session.items = [
StubFunctionItem(
stub,
nodeid='X/Y/Z/test_eggs.py::SpamTests::test_spam',
nodeid='x/y/z/test_eggs.py::SpamTests::test_spam',
name='test_spam',
location=('x/y/z/test_eggs.py', 12, 'SpamTests.test_spam'),
location=('X/Y/Z/test_eggs.py', 12, 'SpamTests.test_spam'),
fspath=testroot + '\\' + relfile,
function=FakeFunc('test_spam'),
),
Expand Down Expand Up @@ -825,12 +825,12 @@ def normcase(path):
id=r'.\x\y\z\test_eggs.py::SpamTests::test_spam',
name='test_spam',
path=TestPath(
root=testroot,
relfile=r'.\X\Y\Z\test_eggs.py',
root=testroot, # not normalized
relfile=r'.\X\Y\Z\test_eggs.py', # not normalized
func='SpamTests.test_spam',
sub=None,
),
source=r'.\X\Y\Z\test_eggs.py:{}'.format(13),
source=r'.\X\Y\Z\test_eggs.py:{}'.format(13), # not normalized
markers=None,
parentid=r'.\x\y\z\test_eggs.py::SpamTests',
),
Expand Down
54 changes: 52 additions & 2 deletions pythonFiles/tests/testing_tools/adapter/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@


def resolve_testroot(name):
projroot = os.path.normcase(
os.path.join(DATA_DIR, name))
projroot = os.path.join(DATA_DIR, name)
return projroot, os.path.join(projroot, 'tests')


Expand Down Expand Up @@ -256,6 +255,57 @@ def test_discover_syntax_error(self):
)
self.assertIn('(exit code 2)', cm.exception.output)

def test_discover_normcase(self):
projroot, testroot = resolve_testroot('NormCase')

out = run_adapter('discover', 'pytest',
'--rootdir', projroot,
testroot)
result = json.loads(out)

self.maxDiff = None
self.assertTrue(projroot.endswith('NormCase'))
fix_id = os.path.normcase
self.assertEqual(result, [{
'root': projroot,
'rootid': '.',
'parents': [
{'id': fix_id('./tests'),
'kind': 'folder',
'name': 'tests',
'parentid': '.',
},
{'id': fix_id('./tests/A'),
'kind': 'folder',
'name': fix_id('A'),
'parentid': fix_id('./tests'),
},
{'id': fix_id('./tests/A/b'),
'kind': 'folder',
'name': 'b',
'parentid': fix_id('./tests/A'),
},
{'id': fix_id('./tests/A/b/C'),
'kind': 'folder',
'name': fix_id('C'),
'parentid': fix_id('./tests/A/b'),
},
{'id': fix_id('./tests/A/b/C/test_Spam.py'),
'kind': 'file',
'name': fix_id('test_Spam.py'),
'parentid': fix_id('./tests/A/b/C'),
},
],
'tests': [
{'id': fix_id('./tests/A/b/C/test_Spam.py::test_okay'),
'name': 'test_okay',
'source': fix_path('./tests/A/b/C/test_Spam.py:2'),
'markers': [],
'parentid': fix_id('./tests/A/b/C/test_Spam.py'),
},
],
}])


COMPLEX = {
'root': None,
Expand Down