Closed sivakov512 closed 7 years ago
@cryptomaniac512 Take a closer look at the dir locals docs as I don't think you can execute arbitrary lisp that way. Usually you define the mode when you want the variables included.
Here is an example where something dynamic is performed.
((python-mode . ((eval . (setq exec-path (append exec-path `(,"~/bin")))))))
I've copy pasta'd that from another example, so please read the docs to get a better idea of how to use it. Usually it is just setting static values.
I show only part of the configuration, somehow related to the problem :)
Here is complete code of my .dir-locals.el
((nil . ((eval . (progn
(add-to-list 'exec-path (concat (locate-dominating-file default-directory dir-locals-file) "src/frontend/node_modules/.bin/"))
(venv-workon "py3_backoffice")
(setq python-shell-interpreter "python"
python-shell-interpreter-args (concat "-i " (expand-file-name (locate-dominating-file default-directory dir-locals-file)) "src/manage.py shell --plain"))
(setq pytest-project-root-test (lambda (dirname) (equal dirname "src")))
(setq js-indent-level 2))))))
If I remove (setq pytest-project-root-test (lambda (dirname) (equal dirname "src")))
then pytest starts, but not in needed directory. How can I set correctly directory for running test? This is src
directory inside project root.
Solved with (add-to-list 'pytest-project-root-files "pytest.ini")
My
pytest.ini
is located in thesrc
directory of the project's root. I have this setting in.dir-locals.el
:(setq pytest-project-root-test (lambda (dirname) (equal dirname "src")))
When I run
pytest-all
,pytest-module
or any other I get "No such directory found via CDPATH environment variable".What am I doing wrong? :)