tarpas / pytest-testmon

Selects tests affected by changed files. Executes the right tests first. Continuous test runner when used with pytest-watch.
https://testmon.org
MIT License
839 stars 56 forks source link

testmon >=2.0.0 does not work with pytest-xdist #234

Open szym opened 4 months ago

szym commented 4 months ago

What is your setup and what steps did you do?

pip install pytest-testmon==2.1.1 pytest-xdist==3.6.1
pytest -n2 --testmon

What was the outcome?

initialized: 2/2 workersINTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/_pytest/main.py", line 281, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/_pytest/config/__init__.py", line 1130, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/pluggy/_hooks.py", line 535, in call_historic
INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls.copy(), kwargs, False)
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/testmon/pytest_testmon.py", line 239, in pytest_configure
INTERNALERROR>     init_testmon_data(config)
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/testmon/pytest_testmon.py", line 174, in init_testmon_data
INTERNALERROR>     testmon_data = TestmonData(
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/testmon/testmon_core.py", line 163, in __init__
INTERNALERROR>     result = self.db.initiate_execution(
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/testmon/db.py", line 696, in initiate_execution
INTERNALERROR>     exec_id, packages_changed = self.fetch_or_create_environment(
INTERNALERROR>   File "/Users/szym/Library/Python/3.8/lib/python/site-packages/testmon/db.py", line 641, in fetch_or_create_environment
INTERNALERROR>     con.execute("BEGIN IMMEDIATE TRANSACTION")
INTERNALERROR> sqlite3.OperationalError: attempt to write a readonly database

What did you expect instead? Don't crash.

What is your operating system and it's version please? macOS 11.7

szym commented 4 months ago

I think this broke with v2 which added db writes in TestmonData.__init__: https://github.com/tarpas/pytest-testmon/commit/674648375a899f212d192408530eb09637960a44