Questions tagged [conftest]

56 questions
0
votes
1 answer

How to use the output of a fixture as input to a function as parametrize pytest

My aim is to pass a value to the fixture from test_add and the fixture in returns a list of tuples which will be required to pass it as parametrize to the test_add function. Below is the code iam trying for which not working File :…
killer
  • 1
  • 1
0
votes
0 answers

Why am I getting this error in the conftest - ImportError while loading conftest

Following is the error I am getting in command Prompt: ImportError while loading conftest 'C:\Users\skatore\PycharmProjects\pythonProjectAgilityFairs\tests\conftest.py'. conftest.py:12: in class Testconf1: conftest.py:50: in…
0
votes
0 answers

Mixing pytest conftest.py with unittests: Typeerror

My conftest.py @pytest.fixture(scope="class") def prepare_test_dataframe(): try: with pd.ExcelFile(TEST_INPUT_DIR + TEST_FILE_NAME) as xls: for sheet_name in xls.sheet_names: if sheet_name == "TESTSHEET1": …
pymat
  • 1,090
  • 1
  • 23
  • 45
0
votes
2 answers

Pytest ImportError and ModuleNotFoundError when running test from a sub directory

I have the below project structure - root - main.py - test/ - __init__.py - conftest.py - test.py In conftest.py I have some custom fixtures using mysql.connector. Therefore I am importing: import…
bcsta
  • 1,963
  • 3
  • 22
  • 61
0
votes
1 answer

Conftest Exception Rule Fails with Kustomization & Helm

I'm having in one of my projects several k8s resources which is built, composed and packaged using Helm & Kustomize. I wrote few OPA tests using Conftest where one of the check is to avoid running containers as root. So here is my deployment.yaml in…
joesan
  • 13,963
  • 27
  • 95
  • 232
0
votes
1 answer

Conftest Fails For a Valid Kubernetets YAML File

I have the following simple Kubernetes YAML Deployment: apiVersion: apps/v1 kind: Deployment metadata: name: {{ .Values.app.name }} namespace: {{ .Values.app.namespace }} spec: selector: matchLabels: app: {{ .Values.app.name }} …
joesan
  • 13,963
  • 27
  • 95
  • 232
0
votes
1 answer

Getting error when oneTimeSetup method has fixture scope="session"

I have implemented the selenium python framework using unittest and pytest with the page object model. I have created a conftest.py file with oneTimeSetup method which will initialize the webdriver and then it will be used by all my test files.…
Atique
  • 45
  • 6
0
votes
1 answer

Is there a way to customise the format for logging in pytest from conftest.py

Am new to pytest and am trying to setup logging I have the following code in my conftest.py file def pytest_logger_config(logger_config): logger_config.add_loggers([log_fname], stdout_level=logging.INFO) …
user1007839
  • 23
  • 2
  • 9
0
votes
1 answer

Using opa http.send with conftest

I have a question about data importing and the execution of built-in opa function when using conftest. In the below code sample I have two modules abc and main. I've conveniently left out some of the set up for abc all that matters is that it's a…
b0bu
  • 1,062
  • 1
  • 9
  • 24
-1
votes
1 answer

How obtain a variable into the conftest file from a test file?

Advice me please how can I obtain my TEST_NAME constant into the conftest.py file from my test files? Let's say I have many test files which contain the same constant TEST_NAME like as follows dummy example: # test_01.py file TEST_NAME = "C4901. Get…
Alex AL
  • 1
  • 2
-1
votes
1 answer

Use conftest.py fixtures in non-test function

Below is the Server.py file class Server(): def __init__(self, certral=None, user=None, password=None): cwd = os.path.dirname(__file__) self.propPath = cwd + "/../server-profiles.json" …
RR HS
  • 3
  • 3
1 2 3
4