pytest-testmon завершается с ошибкой TypeError во время записи результатов - PullRequest
2 голосов
/ 01 мая 2020

Почему pytest --testmon терпит неудачу со следующим исключением?

=========================================================================================== 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'

Со следующими библиотеками, установленными через pip:

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

I'm используя python3 .7, попытался изменить версию pytest-testmon tp 1.0.2, но также не удалось

1 Ответ

1 голос
/ 02 мая 2020

Похоже, что json-datetime==0.0.5 нарушение зависимости testmon. Это достаточно для импорта:

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

def test_something():
  assert 1 == 1
...