Support dynamic ports
This commit is contained in:
@@ -13,7 +13,7 @@ import pytest
|
||||
|
||||
TIMEOUT = 10
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
URL = "http://spoolman:" + os.environ.get("PORT", "8000")
|
||||
|
||||
|
||||
class DbType(StrEnum):
|
||||
@@ -43,7 +43,7 @@ def _wait_for_server(): # noqa: ANN202
|
||||
start_time = time.time()
|
||||
while True:
|
||||
try:
|
||||
response = httpx.get("http://spoolman:8000", timeout=1)
|
||||
response = httpx.get(URL, timeout=1)
|
||||
response.raise_for_status()
|
||||
except httpx.HTTPError: # noqa: PERF203
|
||||
if time.time() - start_time > TIMEOUT:
|
||||
|
||||
@@ -6,9 +6,7 @@ from datetime import datetime, timezone
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from ..conftest import assert_httpx_success, assert_lists_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_httpx_success, assert_lists_compatible
|
||||
|
||||
|
||||
def test_add_text_field():
|
||||
|
||||
@@ -4,9 +4,7 @@ import json
|
||||
|
||||
import httpx
|
||||
|
||||
from ..conftest import assert_httpx_success
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_httpx_success
|
||||
|
||||
|
||||
def test_delete_field():
|
||||
|
||||
@@ -4,9 +4,7 @@ import json
|
||||
|
||||
import httpx
|
||||
|
||||
from ..conftest import assert_httpx_success, assert_lists_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_httpx_success, assert_lists_compatible
|
||||
|
||||
|
||||
def test_get_field():
|
||||
|
||||
@@ -4,9 +4,7 @@ import json
|
||||
|
||||
import httpx
|
||||
|
||||
from ..conftest import assert_httpx_success
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_httpx_success
|
||||
|
||||
|
||||
def test_add_vendor_with_extra_field():
|
||||
|
||||
@@ -5,9 +5,7 @@ from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from ..conftest import assert_dicts_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_dicts_compatible
|
||||
|
||||
|
||||
def test_add_filament(random_vendor: dict[str, Any]):
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL
|
||||
|
||||
|
||||
def test_delete_filament(random_vendor: dict[str, Any]):
|
||||
|
||||
@@ -7,9 +7,7 @@ from typing import Any
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from ..conftest import assert_lists_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_lists_compatible
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -4,9 +4,7 @@ from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from ..conftest import assert_dicts_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_dicts_compatible
|
||||
|
||||
|
||||
def test_get_filament(random_vendor: dict[str, Any]):
|
||||
|
||||
@@ -4,9 +4,7 @@ from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from ..conftest import assert_dicts_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_dicts_compatible
|
||||
|
||||
|
||||
def test_update_filament(random_vendor: dict[str, Any]):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import httpx
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL
|
||||
|
||||
|
||||
def test_get_currency():
|
||||
|
||||
@@ -4,7 +4,7 @@ import json
|
||||
|
||||
import httpx
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL
|
||||
|
||||
|
||||
def test_set_currency():
|
||||
|
||||
@@ -6,9 +6,7 @@ from typing import Any
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from ..conftest import assert_dicts_compatible, length_from_weight
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_dicts_compatible, length_from_weight
|
||||
|
||||
|
||||
def test_add_spool_remaining_weight(random_filament: dict[str, Any]):
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL
|
||||
|
||||
|
||||
def test_delete_spool(random_filament: dict[str, Any]):
|
||||
|
||||
@@ -7,9 +7,7 @@ from typing import Any
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from ..conftest import assert_lists_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_lists_compatible
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL
|
||||
|
||||
|
||||
def test_get_spool(random_filament: dict[str, Any]):
|
||||
|
||||
@@ -5,9 +5,7 @@ from typing import Any
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from ..conftest import length_from_weight
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, length_from_weight
|
||||
|
||||
|
||||
def test_update_spool(random_filament: dict[str, Any]):
|
||||
|
||||
@@ -8,7 +8,7 @@ from typing import Any
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL
|
||||
|
||||
|
||||
@pytest.mark.parametrize("use_weight", [0, 0.05, -0.05, 1500]) # 1500 is big enough to use all filament
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
|
||||
import httpx
|
||||
|
||||
from .conftest import DbType, get_db_type
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from .conftest import URL, DbType, get_db_type
|
||||
|
||||
|
||||
def test_backup():
|
||||
|
||||
4
tests_integration/tests/vendor/test_add.py
vendored
4
tests_integration/tests/vendor/test_add.py
vendored
@@ -4,9 +4,7 @@ from datetime import datetime, timezone
|
||||
|
||||
import httpx
|
||||
|
||||
from ..conftest import assert_dicts_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_dicts_compatible
|
||||
|
||||
|
||||
def test_add_vendor():
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import httpx
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL
|
||||
|
||||
|
||||
def test_delete_vendor():
|
||||
|
||||
4
tests_integration/tests/vendor/test_find.py
vendored
4
tests_integration/tests/vendor/test_find.py
vendored
@@ -7,9 +7,7 @@ from typing import Any
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from ..conftest import assert_lists_compatible
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL, assert_lists_compatible
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
2
tests_integration/tests/vendor/test_get.py
vendored
2
tests_integration/tests/vendor/test_get.py
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
import httpx
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL
|
||||
|
||||
|
||||
def test_get_vendor():
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import httpx
|
||||
|
||||
URL = "http://spoolman:8000"
|
||||
from ..conftest import URL
|
||||
|
||||
|
||||
def test_update_vendor():
|
||||
|
||||
Reference in New Issue
Block a user