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

os.utime fails to traverse symlinks #49

Closed
cburroughs opened this issue May 26, 2015 · 0 comments
Closed

os.utime fails to traverse symlinks #49

cburroughs opened this issue May 26, 2015 · 0 comments
Labels

Comments

@cburroughs
Copy link

(Tested with 2.4)

Passes:

class TestLink(FakeFS):

    def setUp(self):
        #self.setUpPyfakefs()
        os.makedirs('/tmp/test-foo')
        os.symlink('/tmp/test-foo', '/tmp/test-bar')

    def tearDown(self):
        #self.teardownPyfakefs()
        pass

    def test(self):
        fname = '/tmp/test-bar/a.file'
        with open(fname, 'w') as f:
            f.write('\n')
        os.utime(fname, (time.time(), time.time()))

Fails:

class TestLink(FakeFS):

    def setUp(self):
        self.setUpPyfakefs()
        os.makedirs('/tmp/test-foo')
        os.symlink('/tmp/test-foo', '/tmp/test-bar')

    def tearDown(self):
        self.teardownPyfakefs()
        pass

    def test(self):
        fname = '/tmp/test-bar/a.file'
        with open(fname, 'w') as f:
            f.write('\n')
        os.utime(fname, (time.time(), time.time()))
  File "/home/csb/.local/lib/python2.7/site-packages/fake_filesystem.py", line 1745, in utime
OSError: [Errno 2] No such file or directory in fake filesystem: '/tmp/test-bar/a.file'

(FakeFS is the wraper from https://code.google.com/p/pyfakefs/issues/detail?id=22)

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