sandialabs / OpenCSP

Code for Concentrating Solar Power
Other
1 stars 11 forks source link

Spurious failure in test_with_attrfile #3

Open e10harvey opened 4 months ago

e10harvey commented 4 months ago

This test fails intermittently with:

 pytest -k test_with_attrfile
=================================================================================== test session starts ====================================================================================
platform linux -- Python 3.11.5, pytest-8.0.0, pluggy-1.4.0
rootdir: /code/opencsp
plugins: xvfb-3.0.0
collected 340 items / 339 deselected / 1 selected                                                                                                                                          

common/lib/render/test/test_ImageAttributeParser.py F                                                                                                                                [100%]

========================================================================================= FAILURES =========================================================================================
_______________________________________________________________________ test_ImageAttributeParser.test_with_attrfile _______________________________________________________________________

self = <test_ImageAttributeParser.test_ImageAttributeParser testMethod=test_with_attrfile>

    def test_with_attrfile(self):
        """ Load all values from the associated attributes file. Use the new current_image_source value. """
        parser = iap.ImageAttributeParser(current_image_source=self.img_file)

        # Not 'a' as is in the attributes file associated with self.img_file,
        # but rather the current image source path self.img_file since it is
        # non-None in the constructor.
        self.assertEqual(self.img_file, parser.current_image_source)
        # The rest of these values should be set by the attributes file, since
        # they are not given in the ImageAttributeParser constructor.
>       self.assertEqual(datetime.datetime.fromisoformat('2024-02-17'), parser.date_collected)
E       AssertionError: datetime.datetime(2024, 2, 17, 0, 0) != None

common/lib/render/test/test_ImageAttributeParser.py:55: AssertionError
================================================================================= short test summary info ==================================================================================
FAILED common/lib/render/test/test_ImageAttributeParser.py::test_ImageAttributeParser::test_with_attrfile - AssertionError: datetime.datetime(2024, 2, 17, 0, 0) != None
e10harvey commented 3 months ago

Pending close via #40.

bbean23 commented 3 months ago

Failed ~57/100 times with for i in {0..100}; do python -m pytest --ignore-glob=*integration* --ignore-glob=*opencsp/app* --ignore-glob=*opencsp/common/lib/test* --ignore-glob=**/test_camera_calibration.py --ignore-glob=**/test_image_processing.py --ignore-glob=**/test_VideoHandler.py --ignore-glob=**/sofast/*/test_System.py; done

From the terminal log: MobaXterm_20240321_121800.txt

e10harvey commented 2 months ago

Pending close via #40.

Update: This bug is still present in the production code, but the test_with_attrfile test is currently skipped.