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

Granularity/specificity #3

Open
simon-weber opened this issue Aug 21, 2015 · 3 comments
Open

Granularity/specificity #3

simon-weber opened this issue Aug 21, 2015 · 3 comments

Comments

@simon-weber
Copy link

It'd be nice if knows could key on something more specific than filename, since using knows on large files often isn't helpful.

Here's the additional information I can think of:

  1. line numbers (as referenced in RFC: optimizations #2 (comment)). easy to get: settrace would have granularity inside functions, setprofile would only have the call/return.
  2. function names. easy to get: frame.f_code.co_name
  3. path above the function (eg package.module.Class.method). harder to get: I think you'd need to get a reference to the function and then the qualified name (which in 2.x may involve parsing the ast, which would be very slow).

Ideally, I'd want 2 + 3 so that keys would be qualified paths. This is about as specific as 1, but more robust to edits (since line numbers change often). But since I think 3 is too slow and 2 is not specific enough by itself (eg in the case of two methods of the same name inside different classes), I think 1+2 may be a good compromise.

Thoughts?

@tarpas
Copy link

tarpas commented Aug 22, 2015

Here is a description of technique (and implementation) where function body checksums are referenced . https://github.com/tarpas/pytest-testmon/wiki/Determining-affected-tests
It's quite easy to implement, quick.

@simon-weber
Copy link
Author

Cool, thanks.

I'm trying out just (file, function_name) with Venmo's code and it seems to be working pretty well.

@eyalr
Copy link
Contributor

eyalr commented Aug 25, 2015

I think in the short term (file, function_name) sounds like an already huge improvement over just file. Please send on over a pull request and I'll gladly review. If someone needs that granularity around specific lines changed and feels passionate about contributing it, it would be most welcome as well!

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

No branches or pull requests

3 participants