test(pytest): move pytest fixtures to conftest.py
There are a few benefits for this:
- All fixtures in one module, so single source of truth.
- The fixtures are automatically imported and injected by pytest
so no explicit imports needed for these.
- Linters won't complain about redefinition of outer scope objects.
Co-authored-by: Jens Troeger <jens.troeger@light-speed.de>
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
This commit is contained in:
committed by
Steve Chavez
co-authored by
Jens Troeger
parent
322216c810
commit
c1d9728dc8
@@ -4,7 +4,6 @@ from operator import attrgetter
|
||||
import signal
|
||||
import subprocess
|
||||
import pytest
|
||||
from syrupy.extensions.json import SingleFileSnapshotExtension
|
||||
import yaml
|
||||
|
||||
from config import *
|
||||
@@ -20,15 +19,6 @@ class ExtraNewLinesDumper(yaml.SafeDumper):
|
||||
super().write_line_break()
|
||||
|
||||
|
||||
class YamlSnapshotExtension(SingleFileSnapshotExtension):
|
||||
_file_extension = "yaml"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def snapshot_yaml(snapshot):
|
||||
return snapshot.use_extension(YamlSnapshotExtension)
|
||||
|
||||
|
||||
def itemgetter(*items):
|
||||
"operator.itemgetter with None as fallback when key does not exist"
|
||||
if len(items) == 1:
|
||||
|
||||
Reference in New Issue
Block a user