pyomeca / ezc3d

Easy to use C3D reader/writer for C++, Python and Matlab
https://pyomeca.github.io/Documentation/ezc3d/index.html
MIT License
142 stars 44 forks source link

3 Python tests fail #291

Closed yurivict closed 1 year ago

yurivict commented 1 year ago
============================================================================================================ ERRORS ============================================================================================================
___________________________________________________________________________ ERROR at setup of test_parse_and_rebuild_parameters[C3DRotationExample] ____________________________________________________________________________

request = <SubRequest 'c3d_build_rebuild_reduced' for <Function test_parse_and_rebuild_parameters[Optotrak]>>

    @pytest.fixture(scope="module", params=["BTS", "Optotrak", "Qualisys", "Vicon", "C3DRotationExample"])
    def c3d_build_rebuild_reduced(request):
        base_folder = Path("test/c3dTestFiles")
        orig_file = Path(base_folder / (request.param + ".c3d"))
        rebuild_file = Path(base_folder / (request.param + "_after.c3d"))

        original = ezc3d.c3d(orig_file.as_posix())
        original.write(rebuild_file.as_posix())
        rebuilt = ezc3d.c3d(rebuild_file.as_posix())
        if request.param == "C3DRotationExample":
            rebuilt["parameters"]["ROTATION"]["DATA_START"]["value"][0] = 6

        yield (original, rebuilt)

>       Path.unlink(rebuild_file)

test/python3/test_binder_python.py:512: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = PosixPath('test/c3dTestFiles/Optotrak_after.c3d'), missing_ok = False

    def unlink(self, missing_ok=False):
        """
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        """
        try:
>           self._accessor.unlink(self)
E           FileNotFoundError: [Errno 2] No such file or directory: 'test/c3dTestFiles/Optotrak_after.c3d'

/usr/local/lib/python3.9/pathlib.py:1354: FileNotFoundError
________________________________________________________________________________ ERROR at setup of test_parse_and_rebuild_parameters[Qualisys] _________________________________________________________________________________

request = <SubRequest 'c3d_build_rebuild_reduced' for <Function test_parse_and_rebuild_parameters[BTS]>>

    @pytest.fixture(scope="module", params=["BTS", "Optotrak", "Qualisys", "Vicon", "C3DRotationExample"])
    def c3d_build_rebuild_reduced(request):
        base_folder = Path("test/c3dTestFiles")
        orig_file = Path(base_folder / (request.param + ".c3d"))
        rebuild_file = Path(base_folder / (request.param + "_after.c3d"))

        original = ezc3d.c3d(orig_file.as_posix())
        original.write(rebuild_file.as_posix())
        rebuilt = ezc3d.c3d(rebuild_file.as_posix())
        if request.param == "C3DRotationExample":
            rebuilt["parameters"]["ROTATION"]["DATA_START"]["value"][0] = 6

        yield (original, rebuilt)

>       Path.unlink(rebuild_file)

test/python3/test_binder_python.py:512: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = PosixPath('test/c3dTestFiles/BTS_after.c3d'), missing_ok = False

    def unlink(self, missing_ok=False):
        """
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        """
        try:
>           self._accessor.unlink(self)
E           FileNotFoundError: [Errno 2] No such file or directory: 'test/c3dTestFiles/BTS_after.c3d'

/usr/local/lib/python3.9/pathlib.py:1354: FileNotFoundError
_____________________________________________________________________________________________ ERROR at teardown of test_add_events _____________________________________________________________________________________________

request = <SubRequest 'c3d_build_rebuild_all' for <Function test_parse_and_rebuild_header[Vicon]>>

    @pytest.fixture(scope="module", params=["BTS", "Optotrak", "Qualisys", "Vicon", "Label2"])
    def c3d_build_rebuild_all(request):
        base_folder = Path("test/c3dTestFiles")
        orig_file = Path(base_folder / (request.param + ".c3d"))
        rebuild_file = Path(base_folder / (request.param + "_after.c3d"))

        original = ezc3d.c3d(orig_file.as_posix())
        original.write(rebuild_file.as_posix())
        rebuilt = ezc3d.c3d(rebuild_file.as_posix())

        yield (original, rebuilt)

>       Path.unlink(rebuild_file)

test/python3/test_binder_python.py:495: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = PosixPath('test/c3dTestFiles/Vicon_after.c3d'), missing_ok = False

    def unlink(self, missing_ok=False):
        """
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        """
        try:
>           self._accessor.unlink(self)
E           FileNotFoundError: [Errno 2] No such file or directory: 'test/c3dTestFiles/Vicon_after.c3d'

/usr/local/lib/python3.9/pathlib.py:1354: FileNotFoundError
================================================================================================= 26 passed, 3 errors in 2.78s =================================================================================================
*** Error code 1

Version: 1.5.4 Python 3.9 FreeBSD 13.2

pariterre commented 1 year ago

Hi @yurivict ! Thanks for reporting :) Are the files expected to be? The error seems related to missing files. If they are, from which folder did you try to run the tests?

yurivict commented 1 year ago

It looks like these files are expected by tests.

The tests are run from the root of the project's directory.

pariterre commented 1 year ago

Yep, they are moved by cmake when running CMakeList with tests for C++. If you did not run the tests on C++ prior to the Python tests, they may not be at the right place!

yurivict commented 1 year ago

No, I only build the python part as part of the Python binding's FreeBSD port. The C/C++ part is built in its own port.

pariterre commented 1 year ago

Sorry for late answer! I went to vacation forgetting this issue before!

No, I only build the python part as part of the Python binding's FreeBSD port

That is the reason why. In order to keep the repository as small as possible, I only copy the c3d test files once. Then using the CMake, I dispatch them properly. If you did not build ezc3d yourself, you did not use CMake, meaning the c3d test files were not copied to the folder, explaining why the test can't find them. Just copy-paste the c3d test files into the test/c3dTestFiles/Vicon_after.c3d folder should solve the issue