nathany / looper

Go autotesting tool with readline support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests run twice

darkhelmet opened this issue · comments

Not that it's slow, but when I make a simple change, it runs the tests twice. How does software even work?

It's possible it's getting two events. Are you saving one *.go file? May be related to atomic saves.

I'll see if I can reproduce it. It may be necessary to add some throttling now that any change tests the entire package.

@darkhelmet I'm going to need more info to reproduce this issue. Steps to reproduce, yo?

I'm using my github.com/darkhelmet/blargh package, go in a edit/save post.go, and it runs twice.

go test ./post
ok      github.com/darkhelmet/blargh/post   0.053s
PASS (0.59 seconds)
go test ./post
ok      github.com/darkhelmet/blargh/post   0.060s
PASS (0.57 seconds)

Saving from Sublime Text? (v 2.0.1)? What settings are you using for saving? Gofmt, etc.? I pulled your repo and wasn't able to reproduce it.

I should probably add a --debug option to log what's coming from the watcher. I know prettytest has a bunch of code to throttle the watcher, but this is the first time I've seen a need for it. Your computer must be smoking fast! :-)

I wonder if it's gofmt running.

There would be the save, then gofmt...

On Sun, Jun 23, 2013 at 10:52 PM, Nathan Youngman
notifications@github.comwrote:

Saving from Sublime Text? (v 2.0.1)?

I should probably add a --debug option to log what's coming from the
watcher. I know prettytest has a bunch of code to throttle the watcher, but
this is the first time I've seen a need for it. Your computer must be
smoking fast! :-)


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-19889045
.

@darkhelmet Can you try looper 0.2.1 with looper --debug and let me know what output you get?

I noticed I'm getting new file events when I expected change file events here.

I get Detected file modification post/post.go, then it runs go test ./post, then Detected file modification post/post.go again, then the test again.

Even turning off gofmt doesn't change anything.

~/dev/go/src/github.com/darkhelmet/blargh (master) » looper -debug
Looper 0.2.1 is watching your files
Type help for help.

Debug mode enabled.

Watching path ./
Watching path errors
Watching path filerepo
Watching path filerepo/test
Watching path filerepo/test/repo
Watching path filerepo/test/sort
Watching path html
Watching path html/atom
Watching path html/testdata
Watching path html/testdata/webkit
Watching path html/testdata/webkit/scripted
Watching path post
Watching path post/test
Detected file modification post/post.go
go test ./post
Detected file modification post/post.go
ok      github.com/darkhelmet/blargh/post   0.057s
PASS (0.58 seconds)
go test ./post
ok      github.com/darkhelmet/blargh/post   0.056s
PASS (0.56 seconds)

Hm. That doesn't tell us much. Guess I just need some throttling in place.

Is the fsnotify package up-to-date on your computer?

I installed with -u -v and I believe I remember it updating that package. 

Sent from Mailbox for iPhone

On Mon, Jul 8, 2013 at 11:27 PM, Nathan Youngman notifications@github.com
wrote:

Hm. That doesn't tell us much. Guess I just need some throttling in place.

Is the fsnotify package up-to-date on your computer?

Reply to this email directly or view it on GitHub:
#6 (comment)

Before adding some sort of throttling to my RecursiveWatcher, I emailed @howeyc to see if this is something that can be resolved in fsnotify or if I just made a dumb mistake in my use of it.

For some reason this is happening to me now, which will make it a lot easier to debug. @howeyc didn't feel that a ThrottledWatcher belonged in fsnotify proper, but I'm starting work on a fsnotify-ext package.

Started on https://github.com/gophertown/fsnotify_ext, but still a lot to do!

@darkhelmet I have an open pull request to throttle events in fsnotify howeyc/fsnotify#65. Testing it out with Looper now.

It has been pointed out that this is caused by Spotlight. howeyc/fsnotify#62

One solution is to add your development folder to the Spotlight Privacy settings, at least until we have a better option.

Related issue: running the tests for code.google.com/p/go.tools/cmd/cover generates Go code in testdata, which triggers the tests. Need some way to ignore certain folders (.looperignore).

My tests run three times currently from vim (lucky me) on OSX whenever I save a change. Would it be worth ignoring a small window of file notification activity when receiving a change event to avoid this? (like 50/100 ms?)

That might work. Hugo has something like that in place.

I'm not a vim user, but besides modifying Spotlight Privacy settings (mentioned above), you could also try tweaking your .vimrc file. These settings are from thoughtbot's config

set nobackup
set nowritebackup
set noswapfile

Thx @nathany. Modifying the vim config dropped one of the three. Adding the project folder to Spotify Privacy didn't seem to have any effect.

Progress.

This is Hugo's code to batch up notifications. Not sure when I'll get a chance to implement it, but I'd welcome a pull request. 😉

https://github.com/spf13/hugo/blob/master/watcher/batcher.go