Clarifying Python TDD Practices with pytest , Am I on the Right Track?

One of your questions was whether tests should pass regardless of test data. The answer is: only if the expected behavior is still valid.

TDD tests are tied to behavior, not specific inputs.

In your case, hardcoded paths like \\pytest\\nif\\base might become brittle. If someone changes a directory name or adds a symbolic link, your tests might fail unexpectedly. You can mitigate this by either:

Using fixtures or mocks to simulate the file structure,

Or adding setup code to dynamically prepare test directories.

Example with tmp_path (pytest built-in):

def test_result_path_exists(tmp_path):
    result_dir = tmp_path / "results"
    result_dir.mkdir()
    assert result_dir.exists()

This ensures your tests aren’t tied to hardcoded filesystem states, which is vital when test data changes often.

Happy to help :slight_smile: