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

Suite reruns few times #12

Closed
Glueon opened this issue Jun 9, 2015 · 18 comments
Closed

Suite reruns few times #12

Glueon opened this issue Jun 9, 2015 · 18 comments

Comments

@Glueon
Copy link

Glueon commented Jun 9, 2015

If it's important I am using pytest-watch with https://github.com/pytest-dev/pytest-incremental.

When I update any source file sometimes pytest-watch reruns test twice, sometimes even three times. Is it a problem or a feature?

@joeyespo
Copy link
Owner

joeyespo commented Jun 9, 2015

Interesting. Does it happen when not using the incremental plugin?

If incremental works by manipulating the files system, that could be why.

@Glueon
Copy link
Author

Glueon commented Jun 9, 2015

Actually I realized it happens even if I use loopfail feature from xdist. The only difference is that with xdist I've never seen test reruning 3 time in a row :) If you use the same code base as xdist then maybe it's a xdists's bug.

@blueyed
Copy link
Collaborator

blueyed commented Jun 9, 2015

What editor are you using?
It might create a temporary file first, and then move it etc.

@Glueon
Copy link
Author

Glueon commented Jun 10, 2015

Just VIM. backupdir, undodir and a directory settings are all located in the subderictories under ~/.vim/. So they shouldn't interfear.

@aldanor
Copy link
Contributor

aldanor commented Jun 10, 2015

@joeyespo Seems like the same problem I've been seeing :)

@blueyed
Copy link
Collaborator

blueyed commented Jun 10, 2015

@Glueon
You could add a print(event) to ChangeHandler.on_any_event to see what happens. It appears to work fine for me - there's only one event for me:

<FileModifiedEvent: src_path='/tmp/foo/file'>

@aldanor
Copy link
Contributor

aldanor commented Jun 10, 2015

@blueyed @Glueon I already fixed it a few hours ago in #11 PR

@Glueon
Copy link
Author

Glueon commented Jun 10, 2015

@aldanor
Well seems that it's still an issue. As I said I am using docker-compose run --rm my_container pwt to run the tests. My code folder is mounted using volume from a host machine. So when I save a file in VIM it runs tests exactly 3 times.

I have added a print(event) statement. It fires up 6 events.
Also I looked the version and it still says 2.0.0 even after I installed it via pip specying git repo. And the example usage with new featues outputs usage promt ...

@aldanor
Copy link
Contributor

aldanor commented Jun 10, 2015

@Glueon
Have you tried the code from #11 branch (it hasn't been merged into master yet)?

@Glueon
Copy link
Author

Glueon commented Jun 10, 2015

@aldanor
Oh, snap. I thougt it's in the master branch.
Your version fires up 3 events: created, deleted and modified, but runs only once. These 3 event seem kind of strange, but as soon as it runs once I am totally ok with that.

@aldanor
Copy link
Contributor

aldanor commented Jun 10, 2015

Yep, that's caused by atomic saves, hence we have to spool events manually

@Glueon
Copy link
Author

Glueon commented Jun 10, 2015

@joeyespo As soon as these changes get merged you can close this issue.

@blueyed
Copy link
Collaborator

blueyed commented Jun 10, 2015

Great!

@Glueon
It's related to Vim's backupcopy setting. You could use set backupcopy=yes.

@Glueon
Copy link
Author

Glueon commented Jun 10, 2015

@blueyed

This will reduce 3 events to 1?
Thanks.

@blueyed
Copy link
Collaborator

blueyed commented Jun 10, 2015

Just for reference: here is a list how different editors handle this: https://github.com/guard/guard/wiki/Analysis-of-inotify-events-for-different-editors

@joeyespo
Copy link
Owner

@blueyed That's a fantastic reference. Thanks!

@joeyespo
Copy link
Owner

@Glueon Merged! Thanks for opening the issue.

@joeyespo
Copy link
Owner

FYI Released pytest-watch 3.0.0 today, which includes the merged changes from #11. Be sure to pip install --upgrade pytest-watch and let me know if something broke!

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

4 participants