Support dynamic ports

This commit is contained in:
hcooper
2024-01-23 11:16:57 -08:00
committed by Hereward Cooper
parent f294561d57
commit 1273b20224
27 changed files with 30 additions and 55 deletions
+2 -2
View File
@@ -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():
+1 -3
View File
@@ -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():
+1 -3
View File
@@ -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
+1 -3
View File
@@ -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]):
+1 -1
View File
@@ -2,7 +2,7 @@
import httpx
URL = "http://spoolman:8000"
from ..conftest import URL
def test_get_currency():
+1 -1
View File
@@ -4,7 +4,7 @@ import json
import httpx
URL = "http://spoolman:8000"
from ..conftest import URL
def test_set_currency():
+1 -3
View File
@@ -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]):
+1 -1
View File
@@ -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]):
+1 -3
View File
@@ -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
+1 -1
View File
@@ -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]):
+1 -3
View File
@@ -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]):
+1 -1
View File
@@ -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
+1 -3
View File
@@ -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():
+1 -3
View File
@@ -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():
+1 -1
View File
@@ -2,7 +2,7 @@
import httpx
URL = "http://spoolman:8000"
from ..conftest import URL
def test_delete_vendor():
+1 -3
View File
@@ -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
+1 -1
View File
@@ -2,7 +2,7 @@
import httpx
URL = "http://spoolman:8000"
from ..conftest import URL
def test_get_vendor():
+1 -1
View File
@@ -2,7 +2,7 @@
import httpx
URL = "http://spoolman:8000"
from ..conftest import URL
def test_update_vendor():