smarkets / marge-bot

A merge-bot for GitLab
BSD 3-Clause "New" or "Revised" License
693 stars 136 forks source link

Fix tests by adding pip constraint for importlib-metadata. #370

Open theipster opened 1 year ago

theipster commented 1 year ago

The tests workflow currently fails on master, with a bunch of errors:

_________________________________ FLAKE8-check _________________________________
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pluggy/manager.py:87: in <lambda>
    firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/_pytest/runner.py:170: in pytest_runtest_call
    raise e
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/_pytest/runner.py:162: in pytest_runtest_call
    item.runtest()
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pytest_flake8.py:127: in runtest
    self.statistics)
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/py/_io/capture.py:150: in call
    res = func(*args, **kwargs)
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/pytest_flake8.py:203: in check_file
    app.find_plugins(config_finder)
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/flake8/main/application.py:153: in find_plugins
    self.check_plugins = plugin_manager.Checkers(local_plugins.extension)
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/flake8/plugins/manager.py:357: in __init__
    self.namespace, local_plugins=local_plugins
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/flake8/plugins/manager.py:238: in __init__
    self._load_entrypoint_plugins()
/opt/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/site-packages/flake8/plugins/manager.py:254: in _load_entrypoint_plugins
    eps = importlib_metadata.entry_points().get(self.namespace, ())
E   AttributeError: 'EntryPoints' object has no attribute 'get'

See https://stackoverflow.com/a/73932581. It seems like importlib-metadata is only required for tests, not production code.