allure-framework / allure-python

Allure integrations for Python test frameworks
https://allurereport.org/
Apache License 2.0
718 stars 237 forks source link

Unrecognized arguments while running pytest with executable file #677

Closed sush1q closed 2 years ago

sush1q commented 2 years ago

Describe the bug I have script like this to run my tests:

import pytest
import src
import ioctl_module
import allure
import allure_pytest

pytest.main(["-s", src.__path__[0], "--alluredir=./allure_results"])

While I am running it with IDE Debugger it perfectly works and generate allure-report But, when I pack this script with PyInstaller I have this problem while running it:

ERROR: usage: run_tests [options] [file_or_dir] [file_or_dir] [...]
run_tests: error: unrecognized arguments: --alluredir=./allure_results
  inifile: None
  rootdir: /home/administrator/all_com

I used pyinstaller debugger with import info, there I saw that allure was imported used pyinstaller command:

pyinstaller run_tests.py --noconfirm --onedir --name run_tests --add-data src --collect-submodules allure-pytest --collect-submodules allure -d imports

To Reproduce Steps to reproduce the behavior:

  1. pack script by pyinstaller
  2. run packed script

Expected behavior I wanted to generate allure-report after runned tests packed with executable file

Screenshots image

Environment (please complete the following information):

Allure version 2.9.0
Test framework pytest
Allure adaptor allure-pytest@2.9.45
Generate report using allure-pytest@2.9.45