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

CI tests fails due to pytest-cov requiring toml instead of tomli #1392

Closed
weiji14 opened this issue Jul 21, 2021 · 1 comment · Fixed by #1401 or #1564
Closed

CI tests fails due to pytest-cov requiring toml instead of tomli #1392

weiji14 opened this issue Jul 21, 2021 · 1 comment · Fixed by #1401 or #1564
Labels
maintenance Boring but important stuff for the core devs
Milestone

Comments

@weiji14
Copy link
Member

weiji14 commented Jul 21, 2021

Description of the problem

A large chunk of the Python ecosystem is switching from toml to tomli, and this has been causing some breakages lately (mostly temporary as people deal with dependency hell). See nedbat/coveragepy#1180 for a comprehensive list.

Anyways, the GMT Dev Test started failing on 19 Jul 2021 (https://github.com/GenericMappingTools/pygmt/runs/3099541749?check_suite_focus=true#step:15:95), and I've tracked it down to be due to coverage releasing v6.0b1 on the same day (https://pypi.org/project/coverage/6.0b1/). coverage switched to using tomli in nedbat/coveragepy#1186, but pytest-cov 2.12.1 (released 2 Jun 2021) still seems to use toml, hence the breakage (I think).

Error message

Traceback (most recent call last):
  File "/usr/share/miniconda3/envs/pygmt/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/_pytest/config/__init__.py", line 185, in console_main
    code = main()
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/_pytest/config/__init__.py", line 143, in main
    config = _prepareconfig(args, plugins)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/_pytest/config/__init__.py", line 318, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/hooks.py", line 281, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: _multicall(
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/callers.py", line 130, in _multicall
    gen.send(outcome)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/_pytest/helpconfig.py", line 100, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/callers.py", line 114, in _multicall
    res = hook_impl.function(*args)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1003, in pytest_cmdline_parse
    self.parse(args)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1283, in parse
    self._preparse(args, addopts=addopts)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1191, in _preparse
    self.hook.pytest_load_initial_conftests(
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/hooks.py", line 281, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: _multicall(
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/callers.py", line 135, in _multicall
    return outcome.get_result()
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pluggy/callers.py", line 114, in _multicall
    res = hook_impl.function(*args)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pytest_cov/plugin.py", line 126, in pytest_load_initial_conftests
    plugin = CovPlugin(options, early_config.pluginmanager)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pytest_cov/plugin.py", line 177, in __init__
    self.start(engine.Central)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pytest_cov/plugin.py", line 199, in start
    self.cov_controller.start()
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pytest_cov/engine.py", line 44, in ensure_topdir_wrapper
    return meth(self, *args, **kwargs)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/pytest_cov/engine.py", line 209, in start
    self.cov = coverage.Coverage(source=self.cov_source,
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/coverage/control.py", line 196, in __init__
    self.config = read_coverage_config(
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/coverage/config.py", line 544, in read_coverage_config
    config_read = config.from_file(fname, our_file=our_file)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/coverage/config.py", line 273, in from_file
    files_read = cp.read(filename)
  File "/usr/share/miniconda3/envs/pygmt/lib/python3.9/site-packages/coverage/tomlconfig.py", line 59, in read
    raise CoverageException(msg.format(filename))
coverage.exceptions.CoverageException: Can't read '../pyproject.toml' without TOML support. Install with [toml] extra
make: *** [Makefile:39: test] Error 1

Easiest solution would be to add the toml package to this line:

pip install --pre numpy pandas xarray netCDF4 packaging \
ipython pytest-cov pytest-mpl pytest>=6.0 sphinx-gallery

However, this could also just resolve itself in the next few days, depending on when pytest-cov creates a tagged release. So we could just wait and see if things get fixed automatically 🙂

@weiji14 weiji14 added the maintenance Boring but important stuff for the core devs label Jul 21, 2021
@seisman seisman added this to the 0.4.1 milestone Aug 5, 2021
weiji14 added a commit that referenced this issue Aug 5, 2021
Adding tomli to fix the GMT Dev Tests breakages reported
in #1392. This is a temporary measure until `pytest-cov`
releases a new version > 2.12.1.
@weiji14
Copy link
Member Author

weiji14 commented Oct 3, 2021

Reopening because coverage=6.0 was just released on PyPI (https://pypi.org/project/coverage/6.0/) and conda-forge (https://anaconda.org/conda-forge/coverage/files?version=6.0) and breaking the tests again... See https://github.com/GenericMappingTools/pygmt/runs/3781356743?check_suite_focus=true#step:11:93

coverage.exceptions.CoverageException: Can't read '../pyproject.toml' without TOML support. Install with [toml] extra

@weiji14 weiji14 reopened this Oct 3, 2021
weiji14 added a commit that referenced this issue Oct 3, 2021
Adding tomli to fix the GitHub Actions CI test
breakages reported in #1392. This is a temporary
measure until `pytest-cov>2.12.1` is released.
@weiji14 weiji14 changed the title GMT dev test fails due to pytest-cov requiring toml instead of tomli CI tests fails due to pytest-cov requiring toml instead of tomli Oct 3, 2021
weiji14 added a commit that referenced this issue Oct 3, 2021
Adding tomli to fix the GitHub Actions CI test
breakages reported in #1392. This is a temporary
measure until `pytest-cov>2.12.1` is released.

* Remove coverage dependency since it is required by pytest-cov already
sixy6e pushed a commit to sixy6e/pygmt that referenced this issue Dec 21, 2022
Adding tomli to fix the GMT Dev Tests breakages reported
in GenericMappingTools#1392. This is a temporary measure until `pytest-cov`
releases a new version > 2.12.1.
sixy6e pushed a commit to sixy6e/pygmt that referenced this issue Dec 21, 2022
)

Adding tomli to fix the GitHub Actions CI test
breakages reported in GenericMappingTools#1392. This is a temporary
measure until `pytest-cov>2.12.1` is released.

* Remove coverage dependency since it is required by pytest-cov already
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
2 participants