Skip to content

tests involving assert_files_equal() fail on MSYS2 build on windows #50

@JF-soft

Description

@JF-soft

When testing, some text files are generated and are expected to be equal to the ones in the folder tests/files.
When using bincopy-20.1.0.tar.gz package and building for MSYS2 usign a custom PKGBUILD, the files on test/files folder have unix line endings while genereted files contains windows file endings. I solved the problem patching the file test_bincopy.py to modifiy this function:

    def assert_files_equal(self, actual, expected):
        with open(actual, 'rb') as fin:
            actual = fin.read()

        # open(expected, 'wb').write(actual)

        with open(expected, 'rb') as fin:
            expected = fin.read()


to:

    def assert_files_equal(self, actual, expected):
        with open(actual, 'rb') as fin:
            actual = fin.read()

        # JF: handle line endings in windows and mac!
        actual = actual.replace(b"\r\n", b"\n").replace(b"\r", b"\n")
        # open(expected, 'wb').write(actual)

        with open(expected, 'rb') as fin:
            expected = fin.read()

but, it would be nice to update test supporting code to handle mismatch of line endings in actual files with respect to expected files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions