zivid / zivid-python

Official Python package for Zivid 3D cameras
BSD 3-Clause "New" or "Revised" License
40 stars 14 forks source link

Investigate why running samples fails on windows #82

Closed trym-b closed 4 years ago

trym-b commented 4 years ago

For some unknown reason test_samples.py fails when running on windows

This should be investigated

torbsorb commented 4 years ago

Tried this on my windows PC. It produces 3 errors, of which all seem reasonable:

FAILED test/test_camera.py::test_illegal_init - RuntimeError: Unsupported type for argument internal camera: this should fail, type: <class 'str'>.
FAILED test/test_point_cloud.py::test_illegal_init - ValueError: Unsupported type for argument internal_point_cloud. Got <class 'str'>, expected <class 'pybind11_builtins.pybind11_type'>
FAILED test/test_zivid_module_content.py::test_version - AssertionError: assert '0.9.1.1.7.0' == '1.0.0.1.8.1'

The first two failures "should fail". However, shouldn't a wanted failure be logged as success?

I tested this on master, but against python -m pip install zivid. Why would zivid.__version__ be 0.9.1.1.7.0?

torbsorb commented 4 years ago

The reason it fails is that run_samples assumes that test.py is executed from continuous-integration/windows. However, that's not the case for windows. For Linux --workdir /host/continuous-integration/linux as argument for the Docker image. We could use the workingDirectory argument for script. However, @trym-b recommended that we remove --workdir /host/continuous-integration/linux. That's a bigger job than simply making samples test work on windows. That can be solved by removing the depenency on current working directory in run_samples:

-    current_working_directory = Path(os.getcwd()).resolve()
     sample = (
-        current_working_directory
-        / ".."
-        / ".."
-        / "samples"
-        / "sample_{name}.py".format(name=name)
+        Path(__file__) / ".." / ".." / "samples" / "sample_{name}.py".format(name=name)