Skip to content

Separate venv per job #42

@zsol

Description

@zsol

Description

I'm trying to set up thx on the Black repo which is currently using tox. Main motivation is to have watch mode running lints (using precommit) and tests (using pytest).

In Black, we run 3 sets of tests:

  1. regular test cases + ones marked with no_jupyter, which exercise Black's behavior when black[jupyter] is not installed
  2. regular test cases + ones marked with jupyter
  3. fuzz tests

Each of these have slightly different (conflicting) sets of dependencies to be installed in the venv. The tox config currently recreates the venv on each test run and installs the correct deps before each test step. That's suboptimal for running the tests continuously.

What if thx could support separate venvs for jobs? Ideally in the above case I'd like to have at least two venvs: one that has black[jupyter] installed and one that doesn't. Ideally of course, I'd have a third one for fuzzing that also has hypothesmith and lark-parser installed.

Config format strawman

[tool.thx]
python_versions = ["3.9", "3.10"]
requirements = ["common_requirements.txt"]

[tool.thx.jobs.lint]
run = "pre-commit run -a"
once = true

[tool.thx.jobs.test_no_jupyter]
run = [
  "coverage erase",
  "pytest tests --run-optional no_jupyter --cov",
  "coverage report",
]
requirements = ["test_no_jupyter_requirements.txt"]  # merged with common

[tool.thx.jobs.test_jupyter]
run = [
  "coverage erase",
  "pytest tests --run-optional jupyter -m jupyter --cov",
  "coverage report",
]
requirements = ["test_jupyter_requirements.txt"]  # merged with common

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions