Skip to content

Commit

Permalink
add test for no pyproject specified (tool use only)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbode committed Dec 24, 2024
1 parent dd2507e commit aedc98b
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
if: failure()

- name: Run tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
mise config set settings.trusted_config_paths "${PWD}/tests"
mise -C "${PWD}/tests" install
Expand Down
6 changes: 6 additions & 0 deletions tests/.mise.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
#:schema https://raw.githubusercontent.com/jdx/mise/main/schema/mise.json

[tools]
python = { version = "3.12" }
"aqua:bats-core/bats-core" = "latest"

[env]
XDG_DATA_HOME = "{{ env.HOME }}/.local/share"
9 changes: 9 additions & 0 deletions tests/00_no_pyproject/.mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#:schema https://raw.githubusercontent.com/jdx/mise/main/schema/mise.json

[tools]
python = { version = "3.12" }
poetry = { version = "latest" }

[env]
MISE_POETRY_AUTO_INSTALL = "true"
MISE_POETRY_VENV_AUTO = "false"
17 changes: 17 additions & 0 deletions tests/00_no_pyproject/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/00_no_pyproject/poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[virtualenvs]
in-project = true
prefer-active-python = true
12 changes: 12 additions & 0 deletions tests/00_no_pyproject/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tool.poetry]
name = "test"
version = "0.0.0"
description = "Test"
authors = [
"Josh Bode <josh@joincheckmate.com>",
]
package-mode = false

[tool.poetry.dependencies]
python = ">=3.10,<3.13"
pbr = "^6.0.0"
14 changes: 14 additions & 0 deletions tests/00_no_pyproject/test.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#! /usr/bin/env bats

@test "check environment: poetry install in path and functioning" {
version=$(poetry --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
[[ ":${PATH}:" == *":${XDG_DATA_HOME}/mise/installs/poetry/${version}/bin:"* ]]
}

@test "check environment: VIRTUAL_ENV is not set" {
[[ ! -v VIRTUAL_ENV ]]
}

@test "check environment: POETRY_ACTIVE is not set" {
[[ ! -v POETRY_ACTIVE ]]
}
2 changes: 2 additions & 0 deletions tests/01_simple/.mise.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/jdx/mise/main/schema/mise.json

[tools]
python = { version = "3.12" }
poetry = { version = "latest", pyproject="{{ config_root }}/pyproject.toml" }
Expand Down
2 changes: 2 additions & 0 deletions tests/02_auto_venv_with_lock/.mise.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/jdx/mise/main/schema/mise.json

[tools]
python = { version = "3.12" }
poetry = { version = "latest", pyproject="{{ config_root }}/pyproject.toml" }
Expand Down
2 changes: 2 additions & 0 deletions tests/02_auto_venv_without_lock/.mise.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/jdx/mise/main/schema/mise.json

[tools]
python = { version = "3.12" }
poetry = { version = "latest", pyproject="{{ config_root }}/pyproject.toml" }
Expand Down

0 comments on commit aedc98b

Please sign in to comment.