numirias / pytest-json-report

🗒️ A pytest plugin to report test results as JSON
MIT License
147 stars 39 forks source link

make tests pass on Windows #65

Closed jurko-gospodnetic closed 3 years ago

jurko-gospodnetic commented 3 years ago

Currently there is one failing test on Windows:

def test_report_keys(num_processes, make_json):
    data = make_json()
    keys = set([
        'created', 'duration', 'environment', 'collectors', 'tests', 'summary',
        'root', 'exitcode'
    ])
    if num_processes > 0:
        # xdist only reports failing collectors
        keys.remove('collectors')
    assert set(data) == keys
    assert isinstance(data['created'], float)
    assert isinstance(data['duration'], float)
    assert data['root'].startswith('/')
    assert data['exitcode'] == 1

because it checks that data[root] starts with an '/' - and I expect we should instead check whether it's an absolute path using os.path.isabs()

jurko-gospodnetic commented 3 years ago

fixed in pull request #66

numirias commented 3 years ago

Thanks! The project doesn't currently aim to guarantee Windows compatibility, but I'll happily take patches like this one.