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

ScanDir is inconsistent with os.scandir - os.DirEntry objects have resolved path (symlinks) #350

Closed
adw1n opened this issue Feb 22, 2018 · 2 comments
Labels

Comments

@adw1n
Copy link

adw1n commented Feb 22, 2018

Please see attached example
test.py:

import os


def print_scandir():
    try:
        os.makedirs('/tmp/A/B/C/D')
        os.symlink('/tmp/A/B/C', '/tmp/A/C')
    except FileExistsError:
        pass
    print([f.path for f in os.scandir('/tmp/A/C')])


def test(fs):
    print_scandir()


if __name__ == '__main__':
    print_scandir()

expected:

python3.6 test.py
['/tmp/A/C/D']

pyfakefs (tested v3.3 and current master branch):

pytest test.py -s | grep tmp
test.py ['/tmp/A/B/C/D']
@mrbean-bremen
Copy link
Member

Thanks for the report - I will have a look!

@mrbean-bremen
Copy link
Member

Should work in master now - please reopen if you find any problems!

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

No branches or pull requests

2 participants