"""Test whether file utils works right.""" import os import pytest from app_name.utils import file_utils TEST_FILE_PATH = 'test.txt' def test_remove_file(): """Test remove_file removes existing file.""" with open(TEST_FILE_PATH, 'w') as file: file.write('test_value') if os.path.isfile(TEST_FILE_PATH): file_utils.remove_file(TEST_FILE_PATH) result = os.path.isfile(TEST_FILE_PATH) assert not result def test_remove_no_existing_file(): """Test remove_file runs with non-existing file without exception.""" try: file_utils.remove_file('some/unreal/path/to/file.py') except FileNotFoundError: pytest.fail('FileNotFound Exception should not raise')