Skip to content

Commit

Permalink
Avoid --editable mode since it adds all src modules to the path
Browse files Browse the repository at this point in the history
  • Loading branch information
carmocca committed Dec 15, 2022
1 parent 0e32678 commit 1e1417b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci-app-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ jobs:
- name: Install Yarn
run: npm install -g yarn

- name: Install Lightning package
- name: Install package
env:
PACKAGE_NAME: ${{ matrix.pkg-name }}
run: pip install -e .
# do not use -e because it will make both packages available since it adds `src` to `sys.path` automatically
run: pip install .

- name: Adjust tests
if: ${{ matrix.pkg-name == 'lightning' }}
Expand Down
10 changes: 5 additions & 5 deletions tests/tests_examples_app/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import psutil
import pytest
from tests_examples_app.public import _PATH_EXAMPLES

from lightning_app import _PROJECT_ROOT
from lightning_app.storage.path import _storage_root_dir
from lightning_app.utilities.component import _set_context
from lightning_app.utilities.packaging import cloud_compute
Expand All @@ -24,11 +24,11 @@ def pytest_sessionstart(*_):
"""Pytest hook that get called after the Session object has been created and before performing collection and
entering the run test loop."""
for name, url in GITHUB_APP_URLS.items():
if not os.path.exists(os.path.join(_PROJECT_ROOT, "examples", name)):
path_examples = os.path.join(_PROJECT_ROOT, "examples")
Popen(["git", "clone", url, name], cwd=path_examples).wait(timeout=90)
app_path = os.path.join(_PATH_EXAMPLES, name)
if not os.path.exists(app_path):
Popen(["git", "clone", url, name], cwd=_PATH_EXAMPLES).wait(timeout=90)
else:
Popen(["git", "pull", "main"], cwd=os.path.join(_PROJECT_ROOT, "examples", name)).wait(timeout=90)
Popen(["git", "pull", "main"], cwd=app_path).wait(timeout=90)


def pytest_sessionfinish(session, exitstatus):
Expand Down
4 changes: 1 addition & 3 deletions tests/tests_examples_app/public/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

from lightning_app import _PROJECT_ROOT

_PATH_EXAMPLES = os.path.join(_PROJECT_ROOT, "examples")
_PATH_EXAMPLES = os.path.abspath(os.path.join("..", "..", "..", "examples"))
1 change: 1 addition & 0 deletions tests/tests_examples_app/public/test_multi_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def on_before_run_once(self):
return res


# for the skip to work, the package needs to be installed without editable mode
_SKIP_LIGHTNING_UNAVAILABLE = pytest.mark.skipif(not package_available("lightning"), reason="script requires lightning")


Expand Down

0 comments on commit 1e1417b

Please sign in to comment.