Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest: PermissionError x 11 #6

Open
hunterhogan opened this issue Jan 26, 2025 · 0 comments
Open

Pytest: PermissionError x 11 #6

hunterhogan opened this issue Jan 26, 2025 · 0 comments

Comments

@hunterhogan
Copy link

When running Pytest, I get permission errors. A small change to TempCopiedFile cleared it up.

Running pytest with args: ['-p', 'vscode_pytest', '--rootdir=c:\\apps\\cff2toml', 'c:\\apps\\cff2toml\\tests\\models\\files\\test_cff_file.py::test_load_cff_file_loads_metadata_values', ...]
============================= test session starts =============================
platform win32 -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
rootdir: c:\apps\cff2toml
configfile: pyproject.toml
collected 11 items

tests\models\files\test_cff_file.py FFFFF                                [ 45%]
tests\models\files\test_pyproject_toml_file.py FF                        [ 63%]
tests\models\files\test_toml_file.py FFFF                                [100%]

================================== FAILURES ===================================
__________________ test_load_cff_file_loads_metadata_values ___________________

dummy_cff_file_path = 'c:\\apps\\cff2toml\\tests\\dummy_files\\dummy_CITATION.cff'

    def test_load_cff_file_loads_metadata_values(dummy_cff_file_path):
>       with TempCopiedFile(source_file_path=dummy_cff_file_path) as tmp_dummy_cff_file:

tests\models\files\test_cff_file.py:25: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tests.temp_copied_file.TempCopiedFile object at 0x0000023517C0BCE0>
args = (None, None, None)

    def __exit__(self, *args):
>       os.remove(path=self.tmp.name)
E       PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\hunte\\AppData\\Local\\Temp\\tmpwwapma3y'

tests\temp_copied_file.py:17: PermissionError
...

tests\temp_copied_file.py:17: PermissionError
=========================== short test summary info ===========================
FAILED tests/models/files/test_cff_file.py::test_load_cff_file_loads_metadata_values
FAILED tests/models/files/test_cff_file.py::test_load_cff_file_preserves_metadata_order
FAILED tests/models/files/test_cff_file.py::test_save_cff_file - PermissionEr...
FAILED tests/models/files/test_cff_file.py::test_get_version_for_cff_with_default_file_path
FAILED tests/models/files/test_cff_file.py::test_get_title_for_cff_with_default_file_path
FAILED tests/models/files/test_pyproject_toml_file.py::test_get_project_version_metadata_for_pyproject_toml_with_default_file_path
FAILED tests/models/files/test_pyproject_toml_file.py::test_get_project_name_metadata_for_pyproject_toml_with_default_file_path
FAILED tests/models/files/test_toml_file.py::test_load_toml_file_loads_metadata_values
FAILED tests/models/files/test_toml_file.py::test_load_toml_file_preserves_metadata_order
FAILED tests/models/files/test_toml_file.py::test_save_toml_file - Permission...
FAILED tests/models/files/test_toml_file.py::test_save_toml_file_preserves_metadata_order_after_set_existing_metadata
============================= 11 failed in 0.34s ==============================
Finished running tests!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant