JoranHonig / vertigo

Mutation Testing for Ethereum Smart Contracts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Path based comparison in test suite fails on windows

jaymcgrath opened this issue · comments

Running the test suite on windows results in the following error:

==================================== FAILURES ==================================== 
_______________________________ test_relative_path _______________________________ 

tmp_path = WindowsPath('C:/Users/donger/AppData/Local/Temp/pytest-of-donger/pytest-5/test_relative_path0')

    def test_relative_path(tmp_path):
        # Arrange
        (tmp_path / "testdir").mkdir()
        sf_file: Path = tmp_path / "testdir" / "sf.txt"
        sf_file.write_text("some text", encoding="utf-8")
        sf = SourceFile(sf_file)
    
        mutation = Mutation(None, sf, None, tmp_path)
    
        # Act
        relative_path = mutation.relative_path
    
        # Assert
>       assert "testdir/sf.txt" == relative_path
E         - testdir/sf.txt
E         ?        ^
E         + testdir\sf.txt
E         ?        ^

test\mutation\test_mutation.py:42: AssertionError

I believe the way to make this work on both Posix and Windows would be to convert these both to Path objects before comparing them.