-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathshared.py
More file actions
22 lines (20 loc) · 813 Bytes
/
shared.py
File metadata and controls
22 lines (20 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Module to store shared utilities for both unit and integration tests"""
import pytest
from codemodder import global_state
from codemodder.__main__ import RESULTS_BY_CODEMOD
from codemodder.codemods import ALL_CODEMODS
from codemodder.dependency_manager import DependencyManager
@pytest.fixture(autouse=True, scope="function")
def reset_global_state():
"""
Each test represents one full codemodder run. We want to prevent global
state from leaking from one run to another. This includes any data
stored for codemods and global state from CLI run.
"""
yield
DependencyManager.clear_instance()
global_state.set_directory("")
RESULTS_BY_CODEMOD.clear()
for codemod_kls in ALL_CODEMODS:
codemod_kls.CHANGESET_ALL_FILES = []
codemod_kls.CHANGES_IN_FILE = []