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

mutmut show 1 throws TypeError #251

Open
l0b0 opened this issue May 26, 2022 · 7 comments
Open

mutmut show 1 throws TypeError #251

l0b0 opened this issue May 26, 2022 · 7 comments

Comments

@l0b0
Copy link

l0b0 commented May 26, 2022

To reproduce:

  1. Clone https://gitlab.com/victor-engmark/mypy-exercises/
  2. Run mutation tests with mutmut run src/generator/test_all.py
  3. Try to show first mutation with mutmut show 1

Expected result: This should show the first mutation.

Actual result:

Traceback (most recent call last):
  File "/nix/store/fbif83prxzi6g76y6g0nz7c8jxjzp66a-python3.9-mutmut-2.4.0/bin/.mutmut-wrapped", line 9, in <module>
    sys.exit(climain())
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/__init__.py", line 882, in wrapper
    f(*args, **kwargs)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/__main__.py", line 208, in show
    print(get_unified_diff(id_or_file, dict_synonyms))
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/cache.py", line 203, in get_unified_diff
    return _get_unified_diff(source, filename, mutation_id, dict_synonyms, update_cache)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/cache.py", line 214, in _get_unified_diff
    context = Context(
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/__init__.py", line 492, in __init__
    self.dict_synonyms = (dict_synonyms or []) + ['dict']
TypeError: can only concatenate str (not "list") to str

Running mutmut 2.4.0.

@boxed
Copy link
Owner

boxed commented May 26, 2022

Strange. What happens if you change dict_synonyms to JsonDict, dict in setup.cfg?

@l0b0
Copy link
Author

l0b0 commented May 29, 2022

Doesn't help:

$ git diff
diff --git a/setup.cfg b/setup.cfg
index 78fb226..0a0ac2c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,4 +1,4 @@
 [mutmut]
-dict_synonyms=JsonDict
+dict_synonyms=JsonDict, dict
 paths_to_exclude=generators.py,ide_hints.py,name_reuse.py,test_*.py,type_checking
 runner=pytest --assert=plain --exitfirst
$ mutmut show 1
Traceback (most recent call last):
  File "/nix/store/fbif83prxzi6g76y6g0nz7c8jxjzp66a-python3.9-mutmut-2.4.0/bin/.mutmut-wrapped", line 9, in <module>
    sys.exit(climain())
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/__init__.py", line 882, in wrapper
    f(*args, **kwargs)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/__main__.py", line 208, in show
    print(get_unified_diff(id_or_file, dict_synonyms))
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/cache.py", line 203, in get_unified_diff
    return _get_unified_diff(source, filename, mutation_id, dict_synonyms, update_cache)
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/cache.py", line 214, in _get_unified_diff
    context = Context(
  File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/__init__.py", line 492, in __init__
    self.dict_synonyms = (dict_synonyms or []) + ['dict']
TypeError: can only concatenate str (not "list") to str

(I also tried without the space after the comma.)

It works if I completely remove the dict_synonyms setting.

@l0b0
Copy link
Author

l0b0 commented Mar 15, 2023

Still broken.

@olga-govor
Copy link

Up, the same for mumut show, mutmut html, mumut junitxml
Run on python 3.9

@olga-govor
Copy link

workaround: delete dict_synonyms parameter from configuration at all

@l0b0
Copy link
Author

l0b0 commented Dec 20, 2023

Any news on this? Still fails in 2.4.4, both with a list and with a comma-separated string.

@zeronwad
Copy link

zeronwad commented Mar 12, 2024

commenting out this line File "/nix/store/92br825d8l2gfz6mvcd1g6ncdliqmblk-python3-3.9.6-env/lib/python3.9/site-packages/mutmut/__init__.py", line 492, in __init__ self.dict_synonyms = (dict_synonyms or []) + ['dict']

"Fixes" this 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

4 participants