Loading pytest plugin in runtime

26 views
Skip to first unread message

Avi Uziel

unread,
Jul 20, 2020, 6:29:43 AM7/20/20
to PyInstaller
Hi all,

I have an application that execute pytest.main().

simplified code snippet:
---
import pytest
import pytest_html

def run_tests(test_func):
  test_module = os.path.join(sys._MEIPASS, "tests.py")
  return pytest.main(["-vvv", "-p", "pytest_html", "--html=report.html", "--capture=tee-sys", test_module])
---

The result is that pytest-html plugin fails to load:
----
ERROR: usage: aidoc-probe.exe [options] [file_or_dir] [file_or_dir] [...]
aidoc-probe.exe: error: unrecognized arguments: --html=report.html
  inifile: None
  rootdir: D:\prob-test
----
Running the same code without ["-p", "pytest_html", "--html=report.html"] run as expected and I have the standard pytest output. 

I running pyinstaller on Windows box, using conda environment.
In the environment I have pytest-html package installed.

Any help will be appreciated.

Thanks,
Avi

Avi Uziel

unread,
Jul 20, 2020, 7:46:03 AM7/20/20
to PyInstaller
You can use the attached code to reproduce the issue.
poc.py
Reply all
Reply to author
Forward
0 new messages