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

Long test path + name is too long for file system #136

Open
dooferlad opened this issue Nov 13, 2024 · 0 comments
Open

Long test path + name is too long for file system #136

dooferlad opened this issue Nov 13, 2024 · 0 comments

Comments

@dooferlad
Copy link

Bug Report

Current Behavior A clear and concise description of the behavior.
Some tests cause OSError: [Errno 36] File name too long because the test path and test name is too long for the file system to support.

Input Code
Just create a test in a sufficiently long test path.

Expected behavior/code A clear and concise description of what you expected to
happen (or code).
Test to Just Work(tm).

Environment

  • Python(s): [e.g. python3.8, python3.9, ...]
    Python 3.11 on ext4.

Possible Solution

Change path generation code to not substitute os.sep for - and create the full directory hierarchy. I use a short value for --memray-bin-path and this change to the plugin:

        def _build_bin_path() -> Path:
            if self._tmp_dir is None and not os.getenv("MEMRAY_RESULT_PATH"):
                of_id = pyfuncitem.nodeid.replace("::", "-")
                name = f"{self._bin_prefix}/{of_id}.bin"
            else:
                name = f"{uuid.uuid4().hex}.bin"

            result_file = self.result_path / name
            result_file.parent.mkdir(parents=True, exist_ok=True)
            if self._tmp_dir is None and result_file.exists():
                result_file.unlink()
            return result_file

This works in my case because the path is long, but the actual file name is short enough for the file system to support.

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