Skip to content

Commit 8cc6078

Browse files
committed
move aws_session to global conftest
Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com>
1 parent 1486bc2 commit 8cc6078

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

.github/workflows/pr-sglang.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ concurrency:
1414
group: pr-sglang-${{ github.event.pull_request.number }}
1515
cancel-in-progress: true
1616

17+
env:
18+
FORCE_COLOR: "1"
19+
1720
jobs:
1821
check-changes:
1922
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
default_install_hook_types:
22
- commit-msg
33
- pre-commit
4-
- pre-push
54

65
default_stages:
76
- pre-commit
@@ -75,7 +74,7 @@ repos:
7574
name: "🐍 python · Format python"
7675
- id: ruff-check
7776
name: "🐍 python · Lint python"
78-
stages: [pre-push]
77+
args: ["--fix"]
7978
- id: ruff-check
8079
name: "🐍 python · Sort python imports"
8180
args: ["check", "--select", "I", "--fix"]

test/conftest.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,27 @@
1313
"""Common pytest fixtures for all tests under module test/"""
1414

1515
import pytest
16+
from test_utils.aws import AWSSessionManager
17+
from test_utils.constants import DEFAULT_REGION
1618

1719

1820
def pytest_addoption(parser):
1921
parser.addoption("--image-uri", action="store", help="Image URI to be tested")
22+
parser.addoption(
23+
"--region", action="store", default=DEFAULT_REGION, help="AWS Region to test image on AWS"
24+
)
2025

2126

2227
@pytest.fixture(scope="session")
2328
def image_uri(request):
2429
return request.config.getoption("--image-uri")
30+
31+
32+
@pytest.fixture(scope="session")
33+
def region(request):
34+
return request.config.getoption("--region")
35+
36+
37+
@pytest.fixture(scope="session")
38+
def aws_session(region):
39+
return AWSSessionManager(region)

test/sglang/sagemaker/test_sm_endpoint.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from sagemaker.model import Model
2323
from sagemaker.predictor import Predictor
2424
from test_utils import clean_string, random_suffix_name, wait_for_status
25-
from test_utils.aws import AWSSessionManager
2625

2726
# To enable debugging, change logging.INFO to logging.DEBUG
2827
LOGGER = logging.getLogger(__name__)
@@ -50,16 +49,12 @@ def get_hf_token(aws_session):
5049
LOGGER.error(f"Failed to retrieve HuggingFace token: {e}")
5150
raise e
5251

52+
# Do not print secrets token in logs
5353
response = json.loads(get_secret_value_response["SecretString"])
5454
token = response.get("HF_TOKEN")
5555
return token
5656

5757

58-
@pytest.fixture(scope="module")
59-
def aws_session():
60-
return AWSSessionManager()
61-
62-
6358
@pytest.fixture(scope="function")
6459
def model_id(request):
6560
# Return the model_id given by the test parameter

0 commit comments

Comments
 (0)