Skip to content

Commit

Permalink
fix(test): add all python paths that don't error
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau committed Jun 12, 2024
1 parent 203436c commit 9c6b843
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/integration/services/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,26 @@
#
# For further info, check https://github.com/canonical/charmcraft
"""Configuration for services integration tests."""
import contextlib
import sys

import pyfakefs.fake_filesystem
import pytest

from charmcraft import services
from charmcraft.application.main import APP_METADATA, Charmcraft


@pytest.fixture()
def service_factory(fs, fake_path, simple_charm) -> services.CharmcraftServiceFactory:
def service_factory(fs: pyfakefs.fake_filesystem.FakeFilesystem, fake_path, simple_charm) -> services.CharmcraftServiceFactory:
fake_project_dir = fake_path / "project"
fake_project_dir.mkdir()

# Allow access to the real venv library path.
# This is necessary because certifi lazy-loads the certificate file.
fs.add_real_directory(sys.path[-1])
for python_path in sys.path:
with contextlib.suppress(OSError):
fs.add_real_directory(python_path)

factory = services.CharmcraftServiceFactory(app=APP_METADATA)

Expand Down

0 comments on commit 9c6b843

Please sign in to comment.