microcombustion / ctwrap

Python wrapper for batch simulations (e.g. Cantera)
https://microcombustion.github.io/ctwrap/
MIT License
6 stars 5 forks source link

Improve unittests / fix unittest failures #29

Closed ischoegl closed 3 years ago

ischoegl commented 3 years ago

Unittests should probably check whether content is saved correctly (rather than just perform some rudimentary checks).

On linux there are currently two unittest failures:

_________________________________________________________________ TestWrap.test_commandline __________________________________________________________________

self = <test_ctwrap.TestWrap testMethod=test_commandline>

    def test_commandline(self):
        cmd = 'ctwrap'
        name = self._module.__name__.split('.')[-1]
        yaml = "{}".format(Path(EXAMPLES) / self._yaml)
        pars = [name, yaml, '--parallel']

        self.maxDiff = None
        process = subprocess.Popen([cmd] + pars,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.PIPE)
        _, stderr = process.communicate()
>       self.assertEqual(stderr.decode(), '')
E       AssertionError: 'Process Process-5:\nTraceback (most recen[518 chars]nt\n' != ''
E       - Process Process-5:
E       - Traceback (most recent call last):
E       -   File "/home/ischoegl/.pyenv/versions/miniconda3-latest/envs/ctwrap/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
E       -     self.run()
E       -   File "/home/ischoegl/.pyenv/versions/miniconda3-latest/envs/ctwrap/lib/python3.7/multiprocessing/process.py", line 99, in run
E       -     self._target(*self._args, **self._kwargs)
E       -   File "/work/GitHub/ctwrap/ctwrap/simulation.py", line 586, in worker
E       -     obj._save_metadata(metadata)
E       - UnboundLocalError: local variable 'obj' referenced before assignment

tests/test_ctwrap.py:85: AssertionError

and a related one in TestIgnition.test_commandline.

ischoegl commented 3 years ago

Superseded by #32 - the issue above still pops up on a Linux machine (Fedora FC32).