Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd65fd2

Browse files
authored
Added a workflow to parallelise the E2E tests(#697)
* Added a workflow to parallelise the E2E tests. Updated E2E tests to create new table names for each run to avoid issue in parallelisation* Modified parallel code coverage workflow to fail when e2e tests fail* Fixed parallel coverage check pytest command* Modified e2e tests to support parallel execution* Added fallbacks for exit code 5 where we find no test for SEA* Fixed coverage artifact for parallel test workflow* Debugging coverage check merge* Improved coverage report merge and removed the test_driver test for faster testing* Debug commit for coverage merge* Debugging coverage merge 2* Debugging coverage merge 3* Removed unnecessary debug statements from the parallel code coverage workflow* Added unit test and common e2e tests* Added null checks for coverage workflow* Improved the null check for test list* Improved the visibility for test list* Added check for exit code 5* Updated the workflowfor coverage check to use pytst -xdist to run the tests parallely* Enforced the e2e tests should pass* Changed name for workflow job* Updated poetry* Removed integration and previous code coverage workflow* Added the integration workflow again
1 parent30286ad commitfd65fd2

File tree

7 files changed

+145
-62
lines changed

7 files changed

+145
-62
lines changed

‎.github/workflows/coverage-check.yml‎renamed to ‎.github/workflows/code-coverage.yml‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66
on:[pull_request, workflow_dispatch]
77

88
jobs:
9-
coverage:
9+
test-with-coverage:
1010
runs-on:ubuntu-latest
1111
environment:azure-prod
1212
env:
@@ -22,9 +22,9 @@ jobs:
2222
-name:Check out repository
2323
uses:actions/checkout@v4
2424
with:
25-
fetch-depth:0# Needed for coverage comparison
25+
fetch-depth:0
2626
ref:${{ github.event.pull_request.head.ref || github.ref_name }}
27-
repository:${{ github.event.pull_request.head.repo.full_name ||github.repository }}
27+
repository:${{ github.event.pull_request.head.repo.full_name || github.repository }}
2828
-name:Set up python
2929
id:setup-python
3030
uses:actions/setup-python@v5
@@ -61,14 +61,18 @@ jobs:
6161
-name:Install library
6262
run:poetry install --no-interaction --all-extras
6363
#----------------------------------------------
64-
#run all tests
64+
# run all tests with coverage
6565
#----------------------------------------------
66-
-name:Run tests with coverage
67-
continue-on-error:true
66+
-name:Runalltests with coverage
67+
continue-on-error:false
6868
run:|
69-
poetry run python -m pytest \
70-
tests/unit tests/e2e \
71-
--cov=src --cov-report=xml --cov-report=term -v
69+
poetry run pytest tests/unit tests/e2e \
70+
-n auto \
71+
--cov=src \
72+
--cov-report=xml \
73+
--cov-report=term \
74+
-v
75+
7276
#----------------------------------------------
7377
# check for coverage override
7478
#----------------------------------------------
@@ -128,4 +132,5 @@ jobs:
128132
echo "Please ensure this override is justified and temporary"
129133
else
130134
echo "✅ Coverage checks enforced - minimum 85% required"
131-
fi
135+
fi
136+

‎.github/workflows/integration.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ jobs:
5555
# run test suite
5656
#----------------------------------------------
5757
-name:Run e2e tests
58-
run:poetry run python -m pytest tests/e2e
58+
run:poetry run python -m pytest tests/e2e -n auto

‎poetry.lock‎

Lines changed: 69 additions & 13 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pylint = ">=2.12.0"
3939
black ="^22.3.0"
4040
pytest-dotenv ="^0.5.2"
4141
pytest-cov ="^4.0.0"
42+
pytest-xdist ="^3.0.0"
4243
numpy = [
4344
{version =">=1.16.6",python =">=3.8,<3.11" },
4445
{version =">=1.23.4",python =">=3.11" },

‎tests/e2e/test_complex_types.py‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
importpytest
22
fromnumpyimportndarray
33
fromtypingimportSequence
4+
fromuuidimportuuid4
45

56
fromtests.e2e.test_driverimportPySQLPytestTestCase
67

@@ -10,12 +11,15 @@ class TestComplexTypes(PySQLPytestTestCase):
1011
deftable_fixture(self,connection_details):
1112
self.arguments=connection_details.copy()
1213
"""A pytest fixture that creates a table with a complex type, inserts a record, yields, and then drops the table"""
14+
15+
table_name=f"pysql_test_complex_types_table_{str(uuid4()).replace('-','_')}"
16+
self.table_name=table_name
1317

1418
withself.cursor()ascursor:
1519
# Create the table
1620
cursor.execute(
17-
"""
18-
CREATE TABLE IF NOT EXISTSpysql_test_complex_types_table (
21+
f"""
22+
CREATE TABLE IF NOT EXISTS{table_name} (
1923
array_col ARRAY<STRING>,
2024
map_col MAP<STRING, INTEGER>,
2125
struct_col STRUCT<field1: STRING, field2: INTEGER>,
@@ -27,8 +31,8 @@ def table_fixture(self, connection_details):
2731
)
2832
# Insert a record
2933
cursor.execute(
30-
"""
31-
INSERT INTOpysql_test_complex_types_table
34+
f"""
35+
INSERT INTO{table_name}
3236
VALUES (
3337
ARRAY('a', 'b', 'c'),
3438
MAP('a', 1, 'b', 2, 'c', 3),
@@ -40,10 +44,10 @@ def table_fixture(self, connection_details):
4044
"""
4145
)
4246
try:
43-
yield
47+
yieldtable_name
4448
finally:
4549
# Clean up the table after the test
46-
cursor.execute("DELETE FROM pysql_test_complex_types_table")
50+
cursor.execute(f"DROP TABLE IF EXISTS{table_name}")
4751

4852
@pytest.mark.parametrize(
4953
"field,expected_type",
@@ -61,7 +65,7 @@ def test_read_complex_types_as_arrow(self, field, expected_type, table_fixture):
6165

6266
withself.cursor()ascursor:
6367
result=cursor.execute(
64-
"SELECT * FROMpysql_test_complex_types_table LIMIT 1"
68+
f"SELECT * FROM{table_fixture} LIMIT 1"
6569
).fetchone()
6670

6771
assertisinstance(result[field],expected_type)
@@ -83,7 +87,7 @@ def test_read_complex_types_as_string(self, field, table_fixture):
8387
extra_params={"_use_arrow_native_complex_types":False}
8488
)ascursor:
8589
result=cursor.execute(
86-
"SELECT * FROMpysql_test_complex_types_table LIMIT 1"
90+
f"SELECT * FROM{table_fixture} LIMIT 1"
8791
).fetchone()
8892

8993
assertisinstance(result[field],str)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp