Reputation: 23
I am new to python and I need to implement a noxfile on a test project. I installed nox==2024.4.15 and I added a noxfile.py in my project root folder with a plain method to run, based on their documentation from https://nox.thea.codes/en/stable/
import nox
@nox.session(python='3.12')
def tests(session):
session.install('pytest')
session.run('pytest')
I get the following error message when running from PyCharm:
test setup failed file /..../BootcampProject/noxfile.py, line 3
@nox.session(python='3.12') def tests(session): E fixture 'session' not found available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, extra, extras, include_metadata_in_junit_xml, metadata, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, testrun_uid, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory, worker_id use 'pytest --fixtures [testpath]' for help on them.
I need the session variable to install and run different commands, so I don't know how else to get it if not through @nox.session.
Upvotes: 0
Views: 117
Reputation: 23
I solved the issue by running from the command line instead of running from PyCharm:
nox --session tests
Upvotes: 0