[presto] fix boot mode
This commit is contained in:
+1
-2
@@ -29,7 +29,6 @@ Setup:
|
|||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
import gc
|
import gc
|
||||||
import os
|
|
||||||
import time
|
import time
|
||||||
import network
|
import network
|
||||||
import ntptime
|
import ntptime
|
||||||
@@ -2717,5 +2716,5 @@ def main():
|
|||||||
# STARTUP
|
# STARTUP
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
if os.environ.get("PRESTO_TEST_MODE") != "1":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ display is set up as a session-scoped fixture; ``main`` is imported once
|
|||||||
after the mocks are in place.
|
after the mocks are in place.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -17,10 +16,6 @@ _presto_dir = Path(__file__).resolve().parent.parent
|
|||||||
if str(_presto_dir) not in sys.path:
|
if str(_presto_dir) not in sys.path:
|
||||||
sys.path.insert(0, str(_presto_dir))
|
sys.path.insert(0, str(_presto_dir))
|
||||||
|
|
||||||
# Prevent main() from running when we import the module.
|
|
||||||
os.environ["PRESTO_TEST_MODE"] = "1"
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Emulator session setup
|
# Emulator session setup
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -62,7 +57,7 @@ def _emulator():
|
|||||||
def main_module(_emulator):
|
def main_module(_emulator):
|
||||||
"""Import ``main.py`` after the emulator mocks are installed.
|
"""Import ``main.py`` after the emulator mocks are installed.
|
||||||
|
|
||||||
The ``PRESTO_TEST_MODE=1`` guard ensures ``main()`` does not run.
|
The ``__name__ == "__main__"`` guard ensures ``main()`` does not run.
|
||||||
``fetch_thumbnail`` is monkey-patched to raise on any network call.
|
``fetch_thumbnail`` is monkey-patched to raise on any network call.
|
||||||
"""
|
"""
|
||||||
import main
|
import main
|
||||||
|
|||||||
Reference in New Issue
Block a user