Skip to content

Unit test raising FileExistsError in macOS due to case insensitivity during directory creation #992

@achrafmag

Description

@achrafmag

Running unit test:

pytest tests/artifact/test_local_artifact.py::test_get_local_artifact_paths_succeeded_pypi

Raises a FileExistsError during file creation using os.makedirs() macOS due to case insensitivity of the operating system:

Traceback:

Traceback (most recent call last): File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 341, in from_call result: TResult | None = func() ^^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 242, in <lambda> lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__ return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 182, in _multicall return outcome.get_result() ^^^^^^^^^^^^^^^^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_result.py", line 100, in get_result raise exc.with_traceback(exc.__traceback__) File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall teardown.throw(outcome._exception) File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/threadexception.py", line 92, in pytest_runtest_call yield from thread_exception_runtest_hook() File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/threadexception.py", line 68, in thread_exception_runtest_hook yield File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall teardown.throw(outcome._exception) File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py", line 95, in pytest_runtest_call yield from unraisable_exception_runtest_hook() File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py", line 70, in unraisable_exception_runtest_hook yield File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall teardown.throw(outcome._exception) File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/logging.py", line 846, in pytest_runtest_call yield from self._runtest_for(item, "call") File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/logging.py", line 829, in _runtest_for yield File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall teardown.throw(outcome._exception) File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/capture.py", line 880, in pytest_runtest_call return (yield) ^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 167, in _multicall teardown.throw(outcome._exception) File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/skipping.py", line 257, in pytest_runtest_call return (yield) ^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicall res = hook_impl.function(*args) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/runner.py", line 174, in pytest_runtest_call item.runtest() File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/python.py", line 1627, in runtest self.ihook.pytest_pyfunc_call(pyfuncitem=self) File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_hooks.py", line 513, in __call__ return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_manager.py", line 120, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 139, in _multicall raise exception.with_traceback(exception.__traceback__) File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/pluggy/_callers.py", line 103, in _multicall res = hook_impl.function(*args) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/amaghous/work/macaron/.venv/lib/python3.11/site-packages/_pytest/python.py", line 159, in pytest_pyfunc_call result = testfunction(**testargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/amaghous/work/macaron/tests/artifact/test_local_artifact.py", line 219, in test_get_local_artifact_paths_succeeded_pypi os.makedirs(artifact_path) File "<frozen os>", line 225, in makedirs FileExistsError: [Errno 17] File exists: '/private/var/folders/w_/11y_glg95wd5lk71pff76yv80000gn/T/pytest-of-amaghous/pytest-8/test_get_local_artifact_paths_0/.venv/lib/python3.11/site-packages/Macaron-0.13.0.dist-info'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions