diff --git a/presto/main.py b/presto/main.py index 2500355c..a065352a 100644 --- a/presto/main.py +++ b/presto/main.py @@ -29,7 +29,6 @@ Setup: # ============================================================================ import gc -import os import time import network import ntptime @@ -2717,5 +2716,5 @@ def main(): # STARTUP # ============================================================================ -if os.environ.get("PRESTO_TEST_MODE") != "1": +if __name__ == "__main__": main() diff --git a/presto/tests/conftest.py b/presto/tests/conftest.py index 784678ad..b9e771fc 100644 --- a/presto/tests/conftest.py +++ b/presto/tests/conftest.py @@ -6,7 +6,6 @@ display is set up as a session-scoped fixture; ``main`` is imported once after the mocks are in place. """ -import os import sys from pathlib import Path @@ -17,10 +16,6 @@ _presto_dir = Path(__file__).resolve().parent.parent if str(_presto_dir) not in sys.path: 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 # --------------------------------------------------------------------------- @@ -62,7 +57,7 @@ def _emulator(): def main_module(_emulator): """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. """ import main