howeyc/fsnotify

Tests create files in test directory rather than tmp dir.

augustoroman opened this issue · 4 comments

If the test is interrupted, subsequent runs may fail because the test directories or files already exist.

The tests should create a unique dir using os.TempDir().

@mitchellh was telling me that fsnotify won't work on shared filesystems, such as used to share code with Vagrant. Another reason to do tests with os.TempDir() -- I'll look into it once I have a reasonable way to run the existing test suite on multiple operating systems.

I agree, or do what the Go standard library does and use os.TempDir() only if some environmental variable isn't set. Then at least you can set an env var to control where test files go.

Specifically the current suite has this error: failed to create test directory: mkdir _test: file exists

I managed to get this working on Linux/FreeBSD/Windows.