Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Dec 15, 2022
1 parent 9d01397 commit 1aaa0a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lightning_app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed `DDPStrategy` import in app framework ([#16029](https://github.com/Lightning-AI/lightning/pull/16029))
- Fixed `AutoScaler` raising an exception when non-default cloud compute is specified ([#15991](https://github.com/Lightning-AI/lightning/pull/15991))
- Fixed and improvements of login flow ([#16052](https://github.com/Lightning-AI/lightning/pull/16052))

- Fixed detect and ignore venv ([#16056](https://github.com/Lightning-AI/lightning/pull/16056))
- Fixed the debugger detection mechanism for lightning App in VSCode ([#16068](https://github.com/Lightning-AI/lightning/pull/16068))


Expand Down
12 changes: 9 additions & 3 deletions tests/tests_app/runners/test_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
_generate_works_json_web,
_validate_build_spec_and_compute,
)
from lightning_app.source_code import LocalSourceCodeDir
from lightning_app.source_code.copytree import _copytree, _parse_lightningignore
from lightning_app.storage import Drive, Mount
from lightning_app.testing.helpers import EmptyWork
from lightning_app.utilities.cloud import _get_project
Expand Down Expand Up @@ -121,6 +123,13 @@ def project_id():
return "test-project-id"


def write_file_of_size(path, size):
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "wb") as f:
f.seek(size)
f.write(b"\0")


DEFAULT_CLUSTER = "litng-ai-03"


Expand Down Expand Up @@ -1519,15 +1528,12 @@ def run(self):
assert not (path / ".lightningignore").exists()

with mock.patch(
"lightning_app.runners.cloud._parse_lightningignore", wraps=_parse_lightningignore
) as parse_mock, mock.patch(
"lightning_app.source_code.local._copytree", wraps=_copytree
) as copy_mock, caplog.at_level(
logging.WARN
):
cloud_runtime.dispatch()

parse_mock.assert_called_once_with(())
assert copy_mock.mock_calls[0].kwargs["ignore_functions"][0].args[1] == set()

assert (path / ".lightningignore").exists()
Expand Down

0 comments on commit 1aaa0a1

Please sign in to comment.