VB_
VB_

Reputation: 45692

pytest-testmon fails with TypeError during writting to results

Why pytest --testmon fails with the following exception?

=========================================================================================== test session starts ============================================================================================
platform darwin -- Python 3.7.3, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
testmon=True, changed files: 0, skipping collection of 102 files, run variant: default
rootdir: ../my_project
plugins: testmon-0.9.19
collected 0 items / 91 deselected                                                                                                                                                                          
Traceback (most recent call last):
  File "../my_project/venv3_test/bin/pytest", line 8, in <module>
    sys.exit(main())
  File "../my_project/venv3_test/lib/python3.7/site-packages/_pytest/config/__init__.py", line 93, in main
.....................
  File "../my_project/venv3_test/lib/python3.7/site-packages/testmon/pytest_testmon.py", line 242, in pytest_sessionfinish
    self.testmon_data.write_data()
  File "../my_project/venv3_test/lib/python3.7/site-packages/testmon/testmon_core.py", line 197, in write_data
    self._write_attribute('mtimes', self.source_tree.mtimes)
  File "../my_project/venv3_test/lib/python3.7/site-packages/testmon/testmon_core.py", line 160, in _write_attribute
    json_data = json.dumps(data)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
TypeError: encode() missing 1 required positional argument: 'o'

With the following libraries installed through pip:

pytest==5.3.5
pytest-watch==4.2.0
pytest-testmon==0.9.19

I'm using python3.7, tried to change pytest-testmon version tp 1.0.2, but it also fails

Upvotes: 2

Views: 179

Answers (1)

VB_
VB_

Reputation: 45692

It appears that json-datetime==0.0.5 dependency breaking testmon. It's enought importing:

import jsondatetime  # comment this line and the exception will disappear:

def test_something():
  assert 1 == 1

Upvotes: 1

Related Questions