모든 py.test 클래스 메소드에서 공통 데이터를 사용하고 싶습니다. 내가 훨씬 더 3보다가 (py.test 클래스에서 변수 당 하나의 조명기를 만드는 대안이 있습니까?
class TestDatasplit:
@pytest.fixture()
def n_files(self):
return 1000
@pytest.fixture()
def n_classes(self):
return 10
@pytest.fixture()
def n_files_per_class(self, n_files, n_classes):
return int(n_files/n_classes)
def test_datasplit_1(self, n_files):
assert n_files == 1000
def test_datasplit(self, n_files_per_class):
assert n_files_per_class == 100
을하지만, 여기에 내 모든 변수에 대한 고정을 만들 필요가 있지만, 아주 자세한 것 같다
n_files = 1000
n_classes = 10
n_file_per_class = int(n_files/n_classes)
가 나는기구, 예를 사용할 수 있다는 것을 발견 변수) ...
py.test 클래스에서 많은 공유 변수를 만드는 가장 좋은 방법은 무엇입니까?
이 테스트는'unittest.TestCase'에서 파생되지 않은 클래스로 래핑 된 경우'py.test'에 의해 발견됩니까? –