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

Trailing slash has an effect on add_real_directory() #446

Closed
ahshah opened this issue Oct 28, 2018 · 3 comments
Closed

Trailing slash has an effect on add_real_directory() #446

ahshah opened this issue Oct 28, 2018 · 3 comments

Comments

@ahshah
Copy link

ahshah commented Oct 28, 2018

Hi, i'm having a hard time understanding the role a trailing '/' character plays in pyfakefs' add_real_directory() call.

I saw this problem when trying to setup my timezone via pytz. Pytz seems to load the timezone information from a file with in it's installation directory. I've written two tests and ran them like so:

pytest -s test_pytz_fakefs_no_exception.py pytest -s test_pytz_fakefs_with_exception.py

test_pytz_fakefs_no_exception.py seems to fail while test_pytz_fakefs_no_exception.py seems to succeed and I just don't understand why the API would be so stringent. Anyway, thought I'd file it here if it were considered to be a bug.

I've attached the test cases to this ticket, thank you for taking a look.
tests.zip

Pytest/pyfakefs version:
$> pytest --version This is pytest version 3.9.3, imported from /usr/local/lib/python3.6/dist-packages/pytest.py setuptools registered plugins: pytest-mock-1.10.0 at /usr/local/lib/python3.6/dist-packages/pytest_mock.py pyfakefs-3.5 at /usr/local/lib/python3.6/dist-packages/pyfakefs/pytest_plugin.py

Python version:
$> python3 --version Python 3.6.6

@mrbean-bremen
Copy link
Member

Thanks for the report!
The behavior is probably related to mkdir or makedirs, where a trailing slash is not allowed on some systems, IIRC. I agree that it is a needless restriction for our own functions, and can be removed. I will have a closer look in the evening, should be an easy fix.

@ahshah
Copy link
Author

ahshah commented Oct 29, 2018

Thanks for the quick turn around, it maybe helpful to know I tired this on ubuntu 18.04 :)

@mrbean-bremen
Copy link
Member

Thanks - this is really a minor change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants