prospector icon indicating copy to clipboard operation
prospector copied to clipboard

[BUG] toml support is incomplete

Open nat-n opened this issue 2 years ago • 1 comments

prospector fails with stack trace and error like the following in the presence of valid pyproject.toml files.

toml.decoder.TomlDecodeError: Not a homogeneous array (line 152 column 1 char 4093)

To Reproduce

  1. add a line to your pyproject.toml like foo = ["bar", { "baz" = "qux}]
  2. Call prospector
  3. See error

Expected behavior No error

Additional context

The issue here is that prospector uses the toml library which doesn't support the current toml standard.

The solution is to replace toml with tomli, which is part of the python standard library from 3.11.

I'd be happy to create a PR for this if you agree.

nat-n avatar Oct 12 '23 21:10 nat-n

Turns out I'm not this first to notice this, this PR in requirements-detector is already there to address the root cause.

Incidentally it looks like the dependency on toml in this package is redundant.


Also FYI when I setup out this project locally 4 tests were failing out of the box (python 3.10.4 on macOS):

FAILED tests/execution/test_execution.py::test_total_errors - assert 6 == 5
FAILED tests/profiles/test_profile.py::TestProfileInheritance::test_module_file_inheritance - prospector.profiles.exceptions.ProfileNotFound
FAILED tests/profiles/test_profile.py::TestProfileInheritance::test_module_inheritance - prospector.profiles.exceptions.ProfileNotFound
FAILED tests/tools/pylint/test_pylint_tool.py::TestPylintTool::test_wont_throw_false_positive_relative_beyond_top_level - AssertionError: Lists differ: [pylint-django-not-available] != []

nat-n avatar Oct 14 '23 15:10 nat-n