https://pantsbuild.org/ logo
#general
Title
# general
h

happy-family-315

09/12/2022, 10:16 AM
Hi, I am using pants inside a monorepo with hundrets of tests. When running pants test I recognized that each test takes about 7 secs. When using pytest it only takes 200ms. I saw someone else had simmilar problems so I tried the following steps: https://app.slack.com/client/T046T6T8L/C046T6T9U/thread/C046T6T9U-1658183838.164319 I saw that running --setup-only makes nearly no difference in execution time so clearly the setup takes too long and the actual test runs very fast. The output of --setup-only gets stuck at
SETUP    S django_db_setup (fixtures used: django_db_blocker, django_db_createdb, django_db_keepdb, django_db_modify_db_settings, django_db_use_migrations, django_test_environment)
for roughly 6 seconds which is 6/7 of the whole test duration. Running all test in this project would take hours when every tests needs 7-10 secs using pants. With pytest it takes 4 minutes. Does anyone know how to fix this issue or can I try other debugging steps? pytest.ini
Copy code
[pytest]
DJANGO_SETTINGS_MODULE = django_core.settings
# -- standard arguments:
addopts:
	--nomigrations
	--create-db
	-vv
pants.toml
Copy code
[pytest]
lockfile = "lockfiles/python/tools/pytest"
version = "pytest>=7.1.2,<7.2"
extra_requirements.add = [
  "pytest-django==4.5.2",
  "pytest-icdiff==0.5",
  "mixer==7.2.1"
]
config_discovery = true
s

sparse-lifeguard-95737

09/12/2022, 12:58 PM
you are possibly hitting https://github.com/pantsbuild/pants/issues/14941. the only work-around I know of at the moment is to throw more hardware at it - in our CI we shard tests across 16 beefy worker machines
h

happy-kitchen-89482

09/12/2022, 3:08 PM
Yeah, I think that is the case. You’re in a bad corner case where setup time dominates the single test run time. If you could comment on that issue with this information it will help prioritize the work to batch tests