File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
src/lightning_app/utilities/packaging
tests/tests_app/utilities/packaging Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,13 @@ def get_dist_path_if_editable_install(project_name) -> str:
8989
9090
9191def _prepare_lightning_wheels_and_requirements (root : Path ) -> Optional [Callable ]:
92+ """This function determines if lightning is installed in editable mode (for developers) and packages the
93+ current lightning source along with the app.
9294
93- if "site-packages" in _PROJECT_ROOT :
95+ For normal users who install via PyPi or Conda, then this function does not do anything.
96+ """
97+
98+ if not get_dist_path_if_editable_install ("lightning" ):
9499 return
95100
96101 # Packaging the Lightning codebase happens only inside the `lightning` repo.
Original file line number Diff line number Diff line change 11import os
2+ from unittest import mock
23
34import pytest
45
@@ -21,6 +22,21 @@ def test_prepare_lightning_wheels_and_requirement(tmpdir):
2122 assert os .listdir (tmpdir ) == []
2223
2324
25+ def _mocked_get_dist_path_if_editable_install (* args , ** kwargs ):
26+ return None
27+
28+
29+ @mock .patch (
30+ "lightning_app.utilities.packaging.lightning_utils.get_dist_path_if_editable_install" ,
31+ new = _mocked_get_dist_path_if_editable_install ,
32+ )
33+ def test_prepare_lightning_wheels_and_requirement_for_packages_installed_in_editable_mode (tmpdir ):
34+ """This test ensures the source does not get packaged inside the lightning repo if not installed in editable
35+ mode."""
36+ cleanup_handle = _prepare_lightning_wheels_and_requirements (tmpdir )
37+ assert cleanup_handle is None
38+
39+
2440@pytest .mark .skip (reason = "TODO: Find a way to check for the latest version" )
2541@RunIf (skip_windows = True )
2642def test_verify_lightning_version (monkeypatch ):
You can’t perform that action at this time.
0 commit comments