testing

Pytest retry logic upon one unsuccessful test

Pytest retry logic upon one unsuccessful test Question: In my pytest suite, I run plenty of iOS UI tests. Which comes with plenty of frustrating issues. Im experimenting with the use of a hook based retry logic. Essentially, I have a pytest_runtest_call hook, where I collect the output of a test via a yield, and …

Total answers: 1

Pytest does not recognize new command line option

Pytest does not recognize new command line option Question: In my conftest.py I added following code import pytest from selenium import webdriver def pytest_addoption(parser): parser.addoption( "–browser_name", action="store", default="chrome" ) @pytest.fixture(scope="class") def setup(request): browser_name = request.config.getoption("–browser_name") if browser_name == "chrome": driver = webdriver.Chrome() elif browser_name == "firefox": driver = webdriver.Firefox() elif browser_name == "Edge": driver = …

Total answers: 2

Python FAILED AssertionError with GitHub Actions CI / CD Pipeline with AWS

Python FAILED AssertionError with GitHub Actions CI / CD Pipeline with AWS Question: I am trying to reproduce, step-by-step, the instructions on this video "Cloud Resume Challenge Sprint (Sept, 2022) – Week 4" from youtube, https://youtu.be/wiyI0Ngn31o, on how to setup GitHub Actions with CD/CI pipeline for Backend testing with Python for SAM Deployment in AWS. …

Total answers: 1

botocore.exceptions.NoRegionError: You must specify a region. GitHub Actions with CI/CD Pipeline with AWS

botocore.exceptions.NoRegionError: You must specify a region. GitHub Actions with CI/CD Pipeline with AWS Question: I am trying to reproduce, step-by-step, the instructions on this video "Cloud Resume Challenge Sprint (Sept, 2022) – Week 4" from youtube, https://youtu.be/wiyI0Ngn31o, on how to setup GitHub Actions with CD/CI pipeline for Backend testing with Python for SAM Deployment in …

Total answers: 1

pytest-xdist – running parametrized fixtures for parametrized tests once without blocking

pytest-xdist – running parametrized fixtures for parametrized tests once without blocking Question: Consider the following example (which is a simple template of my real issue, of course): import time import pytest @pytest.fixture(scope="session", params=[1, 2, 3, 4, 5]) def heavy_computation(request): print(f"heavy_computation – param is {request.param}") time.sleep(10) return request.param @pytest.mark.parametrize("param", ["A", "B", "C", "D", "E"]) def test_heavy_computation(param, …

Total answers: 1

ModuleNotFoundError on GitHub tox test run

ModuleNotFoundError on GitHub tox test run Question: running tests on GitHub and getting the error message below. Weirdly, this error did not occur with the same setup before. Run python -m tox — –junit-xml pytest.xml py38: install_deps> python -I -m pip install pytest pytest-benchmark pytest-xdist tox: py38 py38: commands[0]> pytest tests/ –ignore=tests/lab_extension –junit-xml pytest.xml ImportError …

Total answers: 1

Why is Django's client.post nesting arg values in lists?

Why is Django's client.post nesting arg values in lists? Question: I’m unit testing my api with Django like this: result = self.client.post( reverse(path), { "arg1":"value" }) Inside the view, I breakpoint. @api_view(["POST"]) def post_arg(request): breakpoint() But when I print the POST data, the values have been added to lists. (Pdb) request.POST { ‘arg1’: [‘value’] } …

Total answers: 1

Test Methods Using pytest

Test Methods Using pytest Question: I am new here trying to learn python. I was working on a speech recognition project, and I need to write some test functions for my code I have used pytest before, with regular functions that returned something, but in this case I am really confused on how to test …

Total answers: 1

Using pytest to reuse the same dataframe across modules in a class

Using pytest to reuse the same dataframe across modules in a class Question: I am trying to reuse the same dataframe in pytest. I have initialised it in the init method but I would like to change it into a pytest fixture then pass it through to each of the methods. I am struggling to …

Total answers: 1

Optimize function's parameters with conditions (python)

Optimize function's parameters with conditions (python) Question: I begin by saying that I am totally new to this branch of programming, but i think that scipy optimization could be the solution. I need to find the parameters that return the highest result in a function, but only if the result respect a condition. The function …

Total answers: 1