DataDog / riot

A Python virtual env builder and command runner
https://ddriot.readthedocs.io/
Apache License 2.0
23 stars 15 forks source link

feat: ensure hash consistency between lockfile and venv #207

Closed emmettbutler closed 1 year ago

emmettbutler commented 1 year ago

This change fixes an issue observable in this test run in which riot generated a requirements lockfile for a Venv instance other than the one it was running tests for. This behavior was happening due to riot logic that skipped Venv instances with pkgs == None while preparing the environment, but not while running tests. Thus the fix is to stop riot from ignoring pkgs-less Venvs in all cases.

Note these two lines of output from the example test run:

Compiling requirements file .riot/requirements/118238b.in
RIOT_VENV_HASH=32bd6c2

This illustrates the mismatch. RIOT_VENV_HASH is the hash of the environment in which the command will be run, and for which the lockfile should be generated. The prepare() function had been ignoring that environment and instead preparing an environment for one of its ancestors.