Granularity/specificity
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:
- line numbers (as referenced in https://github.com/eventbrite/nose-knows/issues/2#issuecomment-128087080). easy to get: settrace would have granularity inside functions, setprofile would only have the call/return.
- function names. easy to get:
frame.f_code.co_name - 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?
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.
Cool, thanks.
I'm trying out just (file, function_name) with Venmo's code and it seems to be working pretty well.
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!