Passing A Py.test Fixture Between Test Files In A Module
I have a common py.test fixture that I want to use generically in different test files within the same module. After reading the py.test documentation, the suggestion was to add th
Solution 1:
I figured out the answer. The issue was that I was using a Unittest
type class instead of a py.test
type class. Technically both can work with py.test
but only py.test
type classes can access fixtures.
So I just changed:
from unittest import TestCase
@pytest.mark.usefixtures('mgmt_data')classTest_param_sweeps(TestCase):
in the OP, to the following:
import pytest
@pytest.mark.usefixtures('mgmt_data')classTest_param_sweeps:
deftest_Base_model(self, mgmt_data):
from pyugend.pyugend.Models import Base_model
t = Base_model(**mgmt_data)
assertisinstance(t, Base_model)
Problem solved.
Post a Comment for "Passing A Py.test Fixture Between Test Files In A Module"