Skip to content

Commit

Permalink
Don't pass COV_CORE_SOURCE to python build subprocess
Browse files Browse the repository at this point in the history
It appears that when this varible is set, pytest-cov will import modules
during the interpreter initialization before the sitecustomize hook
runs. Among the modules imported is sysconfig, which caches its global
state before we're able to modify it, thus rendering the entire hook
unusable.

The documentation for the 'site' module has more details here, but I
wasn't able to find a more aggressive way to prioritize our hook over
others. For now, we should suppress COV_CORE_SOURCE to unblock new tests
in colcon itself.
  • Loading branch information
cottsay committed Sep 5, 2023
1 parent c8995e3 commit 4f443be
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions colcon_core/task/python/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ async def build(self, *, additional_hooks=None): # noqa: D102
env = dict(env)
env['PYTHONPATH'] = str(prefix_override) + os.pathsep + \
python_lib + os.pathsep + env.get('PYTHONPATH', '')
# coverage capture interferes with sitecustomize
env.pop('COV_CORE_SOURCE', None)

# determine if setuptools specific commands are available
available_commands = await self._get_available_commands(
Expand Down

0 comments on commit 4f443be

Please sign in to comment.