I am getting a weird issue testing a very simple export parsing program. The program reads the output results of different types of programs, (which all produce exports in a different format), and logs the results to a database. I have a common IExport class that has five properties, one of which is SequenceNumbers, which is a list of integers. I have several sub-classes of IExport, one of which is KeyenceExport. Here it is in all its glory: import os from IExport import IExport from Lib import get_file_lines class KeyenceExport(IExport): _file_path: str _job_number: str _part_number: str _sequence_numbers: list[int] = [] _file_lines: list[str] = [] def __init__(self, file_path: str): super().__init__(file_path) self._file_path = file_path self._file_lines = get_file_lines(file_path) self._parse_file_lines() def _parse_file_lines(self): line_count = len(self._file_lines) self._part_number = self._file_lines[4].split(",")[0] if "_" in self._part_number: self._part_number = self._part_number.split("_")[0] self._job_number = self._file_lines[4].split(",")[5] for i in range(4, line_count): line = self._file_lines if line == "": continue seq_nbr = line.split(",")[2] self._sequence_numbers.append(int(seq_nbr)) @property def file_path(self) -> str: return self._file_path @property def job_number(self) -> str: return self._job_number @property def part_number(self) -> str: return self._part_number @property def sequence_numbers(self) -> list[int]: return self._sequence_numbers @property def file_name(self) -> str: return os.path.basename(self._file_path) Here are the two test files: SinglePartKeyence.csv Program name,Measurement time,Serial Counter,Judgment,Inspection Type,Job #,Employee #,Machine,Operation,INSP_2,INSP_3,INSP_4,INSP_5,INSP_6,INSP_7,INSP_8.1,INSP_9,INSP_10A,INSP_10B,INSP_11A,INSP_11B Design value,,,,,,,,,0.00000,3.81300,0.75000,0.25000,0.38000,0.31000,0.17900,0.05000,0.12700,0.12700,0.12500,0.12500 Upper Limit,,,,,,,,,0.00100,0.00500,0.01000,0.01000,0.00500,0.00500,0.00000,0.00500,0.00500,0.00500,0.00500,0.00500 Lower Limit,,,,,,,,,0.00000,-0.00500,-0.01000,-0.01000,-0.00500,-0.00500,-0.00150,-0.00500,-0.00500,-0.00500,-0.00500,-0.00500 3000791_B,6/14/2025 9:55:14 AM,0007,OK,IN PROCESS,29831000-014,4544,7804-06,10,0.00044,3.81375,0.75221,0.25177,0.38052,0.31417,0.17801,0.05203,0.12848,0.12844,0.12489,0.12477 MultiPartKeyence.csv Program name,Measurement time,Serial Counter,Judgment,Inspection Type,Job #,Employee #,Machine,Operation,INSP_42 Design value,,,,,,,,,0.025000 Upper Limit,,,,,,,,,1.000000 Lower Limit,,,,,,,,,-1.000000 100165732_E,7/1/2025 12:13:39 AM,0426,OK,IN PROCESS,29781600-005,4701,7803-25,10,0.025865 100165732_E,7/1/2025 12:13:39 AM,0427,OK,IN PROCESS,29781600-005,4701,7803-25,10,0.025735 I have a conftest.py which I won't include the entirety of, but which contain these two fixtures: @pytest.fixture def keyence_filepath(reset_dir): keyence_filepath = path.join(reset_dir, "SinglePartKeyence.csv") return keyence_filepath @pytest.fixture def keyence_multi_part_filepath(reset_dir): keyence_filepath = path.join(reset_dir, "Multi_PartKeyence.csv") return keyence_filepath And then I have the tests themselves: def test_single_part_keyence(keyence_filepath: str): export = KeyenceExport(keyence_filepath) assert export.job_number == "29831000-014" assert export.file_name == "SinglePartKeyence.csv" assert export.part_number == "3000791" assert export.sequence_numbers == [7] def test_multi_part_keyence(keyence_multi_part_filepath: str): export = KeyenceExport(keyence_multi_part_filepath) assert export.job_number == "29781600-005" assert export.file_name == "Multi_PartKeyence.csv" assert export.part_number == "100165732" assert export.sequence_numbers == [426, 427] Ok, that's everything. Sorry for all the code but I've gotten yelled at before for not being thorough when I'm asking a question on here so I'm trying to give you what you need. In any case, if I run the tests by themselves, then they both pass. If I run them together, (I'm using PyCharm btw, so "together" just means I'm running all the tests in that file), then they fail. Here's what I get back: ============================= test session starts ============================= collecting ... collected 2 items test/test_KeyenceExport.py::test_single_part_keyence test/test_KeyenceExport.py::test_multi_part_keyence ========================= 1 failed, 1 passed in 0.09s ========================= PASSED [ 50%]FAILED [100%] test\test_KeyenceExport.py:11 (test_multi_part_keyence) [7, 426, 427] != [426, 427] Expected :[426, 427] Actual :[7, 426, 427] So, for some weird reason, it's adding the sequence number from the first test to the second one, even though each test is newing up a separate instance of the KeyenceExport class. What the heck is going on here? Continue reading...