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

Prepare test suite for traversing Python environments #325

Merged
merged 4 commits into from
Jun 6, 2023

Conversation

jherland
Copy link
Member

@jherland jherland commented May 8, 2023

(Depends on #324)

There are more preparatory steps on the way to integrating Python environments logic into the traverse_project module.

Commits:

  • test_sample_projects: Accept new 'pyenvs' directive in expected.toml
  • sample_projects: Add pyenv_galore 'project'
  • test_traverse_project: Fix incorrect .project member for a test vector
  • test_traverse_project: Prepare for testing with 'pyenvs'

@jherland jherland added this to the Mapping strategy milestone May 8, 2023
@jherland jherland self-assigned this May 8, 2023
@jherland jherland requested review from mknorps and Nour-Mws May 8, 2023 20:06
@jherland jherland force-pushed the jherland/new-directory-traversal branch from 5f59760 to 6caf6cb Compare May 10, 2023 01:12
@jherland jherland force-pushed the jherland/prepare-for-traversing-pyenvs branch from 626aa6c to b3d8bef Compare May 10, 2023 01:13
@jherland jherland force-pushed the jherland/new-directory-traversal branch from 6caf6cb to c56e3fc Compare May 12, 2023 09:17
@jherland jherland force-pushed the jherland/prepare-for-traversing-pyenvs branch from b3d8bef to 598c293 Compare May 12, 2023 09:17
@jherland jherland force-pushed the jherland/new-directory-traversal branch from 59090a9 to b6a5b32 Compare May 30, 2023 11:34
Base automatically changed from jherland/new-directory-traversal to main May 30, 2023 11:41
@dpulls
Copy link

dpulls bot commented May 30, 2023

🎉 All dependencies have been resolved !

jherland added 4 commits May 30, 2023 13:42
Until now, all sample experiments have been run with a cached venv that
is populated with the packages listed in the 'requirements' directive
(empty by default).

This commit allows experiments to declare a `pyenvs` list of directories
(relative to the sample project) to be passed (via settings.pyenvs)
instead of the cached venv. This will allow sample projects to embed
Python environments within their project, which can then be used e.g.
to test the traversal of the project directories.

When given, the `pyenvs` directive will _override_ the `requirements`
directive, meaning that the cached venv will no longer be used to
resolve packages, only the paths passed to 'pyenvs' will be used.
This is not a real project, but merely a collection of different kinds
of Python environments that we should support.

In a future commit, the project traversal code in FawltyDeps will learn
to auto-detect Python environments, and ignore code/deps sources
otherwise found within these. When that is in place, this sample
project's expected.toml will become considerably simpler, as everything
should be correctly detected with default settings. For now, though, we
need to pass very explicit code/deps/pyenvs options in order to
compensate for FawltyDeps' lack of smarts.
One of the test vector passed a nonsense TraverseProjectVector.project
member that did not point to an actual project under
tests/sample_projects. Fix that, and add an assert to the test logic
below to ensure this does not happen again.
We are about to introduce Python environments into the traverse_project
logic. When testing the new logic we will - in addition to passing in
code + deps via settings and expecting corresponding CodeSource and
DepsSource objects to be created - also do the same for settings.pyenvs,
resulting in the creation of PyEnvSource objects.

The default mode of operation will be to auto-detect Python environments
under the current project dir (as we currently do for code + deps).

In order for the new logic not to interfere with the existing code/deps
tests, we must therefore explicitly pass an empty pyenvs set to the
existing tests. This commit does exactly that. A lot of diff noise to
ensure that a future change does not change how these existing tests
will work.
@jherland jherland force-pushed the jherland/prepare-for-traversing-pyenvs branch from 598c293 to 36a78ab Compare May 30, 2023 11:42
Copy link
Collaborator

@Nour-Mws Nour-Mws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jherland jherland merged commit 65ba361 into main Jun 6, 2023
@jherland jherland deleted the jherland/prepare-for-traversing-pyenvs branch June 6, 2023 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants