How to fix 'ValueError: option names {'-alluredir'} already added'?

Viewed 445

I wrote a code using SeleniumWebdriver and tests for it. To build a report on the results of the tests, I added the allure-pytest module.When trying to run tests, I got the error:

ValueError: option names {'--alluredir'} already added

I have another similar project using a module allure-pytest, but it is in a different directory and not linked to the current one Tried to fix the error by reinstalling the module allure-pytest but it didn't work. Please help me solve this problem

Example of code:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


class Authorize:
    path = "/Web/Login"

    def __init__(self, driver):
        self.driver = driver

    def login_page_open_check(self, browse):
        self.driver.get(browse.url + self.path)
        browse = self.driver
        browse.wait = WebDriverWait(browse, 3, 1)
        browse.wait.until(EC.url_to_be('http://10.10.104.61/sio.test/156/ESOG.Main.Web/Web/Login'))
        browse.wait.until(EC.presence_of_element_located((By.CLASS_NAME, "wrap-login")))
        browse.wait.until(EC.presence_of_element_located((By.CLASS_NAME, "auth-form-title")))
        browse.wait.until(EC.presence_of_element_located((By.ID, "Username")))
        browse.wait.until(EC.presence_of_element_located((By.ID, "Password")))
        browse.wait.until(EC.presence_of_element_located((By.XPATH,
                                                          "//*[@class='es-btn primary btn-auth w-100 ' and text()='Enter']")))
        browse.wait.until(EC.presence_of_element_located((By.CLASS_NAME, "txt-auth")))

Example of pytest.ini

[pytest]
addopts = --alluredir allure-results

Example of tests

import allure
from cio_pageobject.cio_authorization import *


@allure.severity(allure.severity_level.BLOCKER)
@allure.title("Open start page")
def test_login_page_check(browse):
    user = Authorize(browse)
    with allure.step("Open start page"):
        try:
            user.login_page_open_check(browse)
        except AssertionError:
            allure.attach(browse.get_screenshot_as_png(), name='Error',
                          attachment_type=allure.attachment_type.PNG)
        raise AssertionError("Error")

Example of error:

  File "C:\Users\nkochetkov\.virtualenvs\pythonProject-VWl9IHiG\lib\site-packages\pluggy\callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "C:\Users\nkochetkov\.virtualenvs\pythonProject-VWl9IHiG\lib\site-packages\allure_pytest\plugin.py", line 25, in pytest_addoption
    help="Generate Allure report in the specified directory (may not exist)")
  File "C:\Users\nkochetkov\.virtualenvs\pythonProject-VWl9IHiG\lib\site-packages\_pytest\config\argparsing.py", line 355, in addoption
    raise ValueError("option names %s already added" % conflict)
ValueError: option names {'--alluredir'} already added
0 Answers
Related