mutmut icon indicating copy to clipboard operation
mutmut copied to clipboard

Pass parameters to pre/post mutation hooks

Open sobolevn opened this issue 6 years ago • 3 comments

Hi @boxed,

I am writing a mutmut plugin to

  1. find duplicated tests (ones that always fails together)
  2. find useless tests (ones that never fail)

To achieve this I am using --post-mutation hook. But, it currently lacks any parameters. And execution code / execution traceback might be very useful.

It can be simple sys.argv data. Or environment variables.

What do you think?

sobolevn avatar May 07 '19 11:05 sobolevn

What do you mean by "execution code / execution traceback"?

I think I like environment variables more because then they can be named in a nice way. But that's not a super strong argument.

boxed avatar May 07 '19 11:05 boxed

I mean these lines:

============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-4.4.1, py-1.8.0, pluggy-0.9.0
Using --randomly-seed=1557169438
rootdir: /home/travis/build/wemake-services/wemake-python-styleguide, inifile: setup.cfg
plugins: randomly-3.0.0, cov-2.7.1
collected 8602 items
tests/test_visitors/test_ast/test_conditions/test_negated_conditions.py . [  0%]
...............                                                          [  0%]
tests/test_visitors/test_ast/test_naming/test_naming_rules/test_wrong_names.py . [  0%]
........................................................................ [  1%]
........................................................................ [  1%]

sobolevn avatar May 07 '19 11:05 sobolevn

Ah, so the output of the test run, gotcha. Yea in that case it has to be an environment variable I think because it's multi line.

boxed avatar May 07 '19 11:05 boxed