The projectile-test-project command and other commands set default-directory to (projectile-compilation-dir) - see https://github.com/bbatsov/projectile/blob/2c948f3a8ed378ae5fd800d2c66aece06ba058b8/projectile.el#L4705
It would be helpful if emacs-python-pytest did the same. It means that you can customize the cwd for a test run using your .dir-locals.el file e.g.:
(python-mode .
((projectile-project-compilation-dir . "my_sub_project_dir")))
This seems like a much nicer workaround for the case of monorepos than the one mentioned in the readme. For example, this method means that if we have multiple different pytest.ini or conftest.py in different sub-projects, they can be picked up correctly. Running with cwd as the root directory is not going to work for many monorepo setups.
Implementation seems to be as simple as changing the definition of python-pytest---project-root:
(defun python-pytest--project-root ()
"Find the project root directory."
(let ((projectile-require-project-root nil))
(projectile-compilation-dir)))
This is working for me, I don't know what other complications it might bring.
The projectile-test-project command and other commands set
default-directoryto(projectile-compilation-dir)- see https://github.com/bbatsov/projectile/blob/2c948f3a8ed378ae5fd800d2c66aece06ba058b8/projectile.el#L4705It would be helpful if emacs-python-pytest did the same. It means that you can customize the cwd for a test run using your
.dir-locals.elfile e.g.:This seems like a much nicer workaround for the case of monorepos than the one mentioned in the readme. For example, this method means that if we have multiple different
pytest.iniorconftest.pyin different sub-projects, they can be picked up correctly. Running withcwdas the root directory is not going to work for many monorepo setups.Implementation seems to be as simple as changing the definition of
python-pytest---project-root:This is working for me, I don't know what other complications it might bring.