diff options
| -rw-r--r-- | bitbake/lib/toaster/tests/functional/functional_helpers.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/tests/functional/functional_helpers.py b/bitbake/lib/toaster/tests/functional/functional_helpers.py index d3e037a6d0..09cf3ba8e0 100644 --- a/bitbake/lib/toaster/tests/functional/functional_helpers.py +++ b/bitbake/lib/toaster/tests/functional/functional_helpers.py | |||
| @@ -28,7 +28,7 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): | |||
| 28 | # So that the buildinfo helper uses the test database' | 28 | # So that the buildinfo helper uses the test database' |
| 29 | if os.environ.get('DJANGO_SETTINGS_MODULE', '') != \ | 29 | if os.environ.get('DJANGO_SETTINGS_MODULE', '') != \ |
| 30 | 'toastermain.settings_test': | 30 | 'toastermain.settings_test': |
| 31 | raise RuntimeError("Please initialise django with the tests settings: " \ | 31 | raise RuntimeError("Please initialise django with the tests settings: " |
| 32 | "DJANGO_SETTINGS_MODULE='toastermain.settings_test'") | 32 | "DJANGO_SETTINGS_MODULE='toastermain.settings_test'") |
| 33 | 33 | ||
| 34 | # start toaster | 34 | # start toaster |
| @@ -38,7 +38,13 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase): | |||
| 38 | cwd=os.environ.get("BUILDDIR"), | 38 | cwd=os.environ.get("BUILDDIR"), |
| 39 | shell=True) | 39 | shell=True) |
| 40 | if cls.p.wait() != 0: | 40 | if cls.p.wait() != 0: |
| 41 | raise RuntimeError("Can't initialize toaster") | 41 | port_use = os.popen("lsof -i -P -n | grep '8000 (LISTEN)'").read().strip() |
| 42 | message = '' | ||
| 43 | if port_use: | ||
| 44 | process_id = port_use.split()[1] | ||
| 45 | process = os.popen(f"ps -o cmd= -p {process_id}").read().strip() | ||
| 46 | message = f"Port 8000 occupied by {process}" | ||
| 47 | raise RuntimeError(f"Can't initialize toaster. {message}") | ||
| 42 | 48 | ||
| 43 | super(SeleniumFunctionalTestCase, cls).setUpClass() | 49 | super(SeleniumFunctionalTestCase, cls).setUpClass() |
| 44 | cls.live_server_url = 'http://localhost:8000/' | 50 | cls.live_server_url = 'http://localhost:8000/' |
