Skip to content

Commit

Permalink
Merge branch 'chore-lighter-tox' into chore-type-hints-for-wait-for-idle
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaqq committed Nov 22, 2024
2 parents e2740a1 + 39ca34c commit f6efcf7
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 56 deletions.
12 changes: 9 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ version: 2

python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
extra_requirements:
- dev
- docs

build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.10"
# Older Shpinx uses imghdr that was removed in Python 3.13
# See e.g. https://github.com/python/cpython/issues/104818
python: "3.12"

sphinx:
configuration: docs/conf.py
16 changes: 0 additions & 16 deletions docs/requirements.txt

This file was deleted.

14 changes: 13 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,19 @@ dependencies = [
"hvac",
"packaging",
"typing-extensions>=4.5.0",
"backports.strenum>=1.3.1",
'backports.strenum>=1.3.1; python_version < "3.11"',
]
[project.optional-dependencies]
dev = [
"typing-inspect",
"pytest",
"pytest-asyncio",
"Twine",
]
docs = [
"sphinx==5.3.0",
"sphinxcontrib-asyncio",
"sphinx_rtd_theme",
]

[project.urls]
Expand Down
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@
"hvac",
"packaging",
"typing-extensions>=4.5.0",
"backports.strenum",
'backports.strenum>=1.3.1; python_version < "3.11"',
],
extras_require={
"dev": [
"typing-inspect",
"pytest",
"pytest-asyncio",
"Twine",
]
},
include_package_data=True,
maintainer="Juju Ecosystem Engineering",
maintainer_email="[email protected]",
Expand Down
14 changes: 9 additions & 5 deletions tests/integration/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from unittest import mock

import paramiko
import pylxd
import pytest

from juju import jasyncio, tag, url
Expand All @@ -29,6 +28,11 @@
from ..utils import GB, INTEGRATION_TEST_DIR, MB, OVERLAYS_DIR, SSH_KEY, TESTS_DIR


@pytest.fixture
def pylxd():
return pytest.importorskip("pylxd")


@base.bootstrapped
async def test_model_name():
model = Model()
Expand Down Expand Up @@ -532,7 +536,7 @@ async def test_add_machine():
assert len(model.machines) == 0


async def add_manual_machine_ssh(is_root=False):
async def add_manual_machine_ssh(pylxd, is_root=False):
# Verify controller is localhost
async with base.CleanController() as controller:
cloud = await controller.get_cloud()
Expand Down Expand Up @@ -677,7 +681,7 @@ def wait_for_network(container, timeout=30):


@base.bootstrapped
async def test_add_manual_machine_ssh():
async def test_add_manual_machine_ssh(pylxd):
"""Test manual machine provisioning with a non-root user.
Tests manual machine provisioning using a randomized username with
Expand All @@ -687,9 +691,9 @@ async def test_add_manual_machine_ssh():


@base.bootstrapped
async def test_add_manual_machine_ssh_root():
async def test_add_manual_machine_ssh_root(pylxd):
"""Test manual machine provisioning with the root user."""
await add_manual_machine_ssh(is_root=True)
await add_manual_machine_ssh(pylxd, is_root=True)


@base.bootstrapped
Expand Down
36 changes: 6 additions & 30 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,19 @@ envlist = py3,py38,py39,py310,py311,docs
skipsdist=True

[testenv]
usedevelop=True
commands =
pip install urllib3<2
pip install pylxd
pytest --tb native -s -k 'not integration' -m 'not serial' {posargs}
use_develop = True
# This should work, but doesn't. Hence the deps= below
# extras = dev
deps =
.[dev]
passenv =
HOME
TEST_AGENTS
LXD_DIR
# FIXME would it be easier to `pip install -e .`?
deps =
macaroonbakery
toposort
typing-inspect
paramiko
ipdb
pytest
pytest-asyncio
Twine
websockets<14.0
kubernetes<31.0.0
hvac
packaging
setuptools
backports.strenum

[testenv:docs]
deps =
-r docs/requirements.txt
.[dev,docs]

allowlist_externals = rm
commands =
Expand All @@ -47,8 +31,6 @@ commands =
[testenv:integration]
envdir = {toxworkdir}/py3
commands =
pip install urllib3<2
pip install pylxd
pytest \
--tb native \
-k 'integration' \
Expand All @@ -60,8 +42,6 @@ commands =
[testenv:integration-quarantine]
envdir = {toxworkdir}/py3
commands =
pip install urllib3<2
pip install pylxd
pytest \
--tb native \
-m 'not serial' \
Expand All @@ -72,8 +52,6 @@ commands =
[testenv:unit]
envdir = {toxworkdir}/py3
commands =
pip install urllib3<2
pip install pylxd
pytest {toxinidir}/tests/unit {posargs}

[testenv:serial]
Expand All @@ -82,8 +60,6 @@ commands =
# it doesn't get run in CI
envdir = {toxworkdir}/py3
commands =
pip install urllib3<2
pip install pylxd
pytest --tb native -s {posargs:-m 'serial'}

[testenv:validate]
Expand Down

0 comments on commit f6efcf7

Please sign in to comment.