Skip to content

Commit

Permalink
Add test to make sure we don't import aiohttp
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbern committed Dec 13, 2024
1 parent 898cafa commit c6020ae
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/slow_dependencies_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import subprocess
import sys


def test_slow_dependencies_local(supports_dir):
# Make sure that "import modal" doesn't load some big dependencies like aiohttp
subprocess.check_output([sys.executable, supports_dir / "slow_dependencies_local.py"])


def test_slow_dependencies_container(supports_dir):
# Make sure that "import modal._container_entrypoint" doesn't load some big dependencies like aiohttp
subprocess.check_output([sys.executable, supports_dir / "slow_dependencies_container.py"])
5 changes: 5 additions & 0 deletions test/supports/slow_dependencies_container.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sys

# This is a very heavy dependency that takes about 70-80ms to import
# Let's make sure it doesn't get imported in global scope
assert "aiohttp" not in sys.modules
5 changes: 5 additions & 0 deletions test/supports/slow_dependencies_local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sys

# This is a very heavy dependency that takes about 70-80ms to import
# Let's make sure it doesn't get imported in global scope
assert "aiohttp" not in sys.modules

0 comments on commit c6020ae

Please sign in to comment.