[App] Install exact version whn upgrading and not when testing (#15984)

* [App] Install exact version whn upgrading and not when testing
* Update CHANGELOG.md

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
This commit is contained in:
Ethan Harris 2022-12-09 14:47:36 +00:00 committed by GitHub
parent cfd00d3e47
commit 1657ea8a39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 5 deletions

View File

@ -37,6 +37,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- Fixed `AutoScaler` failing due to port collision across works ([#15966](https://github.com/Lightning-AI/lightning/pull/15966))
- Fixed a bug where auto-upgrading to the latest lightning via the CLI could get stuck in a loop ([#15984](https://github.com/Lightning-AI/lightning/pull/15984))
- Fixed Registration for CloudComputes of Works in `L.app.structures` ([#15964](https://github.com/Lightning-AI/lightning/pull/15964))

View File

@ -49,8 +49,9 @@ logger = Logger(__name__)
def main() -> None:
# Check environment and versions if not in the cloud
if "LIGHTNING_APP_STATE_URL" not in os.environ:
# Check environment and versions if not in the cloud and not testing
is_testing = bool(int(os.getenv("LIGHTING_TESTING", "0")))
if not is_testing and "LIGHTNING_APP_STATE_URL" not in os.environ:
# Enforce running in PATH Python
_check_environment_and_redirect()

View File

@ -262,6 +262,7 @@ def run_app_in_cloud(
with tempfile.TemporaryDirectory() as tmpdir:
env_copy = os.environ.copy()
env_copy["PACKAGE_LIGHTNING"] = "1"
env_copy["LIGHTING_TESTING"] = "1"
if debug:
env_copy["LIGHTNING_DEBUG"] = "1"
shutil.copytree(app_folder, tmpdir, dirs_exist_ok=True)

View File

@ -254,7 +254,7 @@ def _get_newer_version() -> Optional[str]:
return None if __version__ == latest_version else latest_version
except Exception:
# Return None if any exception occurs
return "err"
return None
def _redirect_command(executable: str):
@ -277,7 +277,7 @@ def _check_version_and_upgrade():
prompt = f"A newer version of {__package_name__} is available ({new_version}). Would you like to upgrade?"
if click.confirm(prompt, default=True):
command = f"pip install --upgrade {__package_name__}"
command = f"pip install '{__package_name__}=={new_version}'"
logger.info(f"⚡ RUN: {command}")

View File

@ -99,7 +99,7 @@ def test_arrow_time_callback():
"1.0.0dev",
None,
),
({"1.0.0": "this wil trigger an error"}, "1.0.0", "err"),
({"1.0.0": "this wil trigger an error"}, "1.0.0", None),
({}, "1.0.0rc0", None),
],
)