Skip to content

Commit 017af0b

Browse files
committed
[SYSTEMDS-3901] Updated Python CI Test setup
- split down of python test runs: w/ env, w/o env, federated - separate python formatting test These changes reduce the runtime of the single tests, and also make the Python test without environment to actually run without the SYSTEMDS_HOME installation. Closes #2300.
1 parent 264bdcd commit 017af0b

File tree

3 files changed

+64
-17
lines changed

3 files changed

+64
-17
lines changed

.github/workflows/python.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ jobs:
5353
os: [ubuntu-24.04]
5454
java: ['17']
5555
javadist: ['adopt']
56+
test_mode: [env, noenv, federated]
5657

57-
name: ${{ matrix.os }} Java ${{ matrix.java }} ${{ matrix.javadist }} Python ${{ matrix.python-version }}
58+
name: ${{ matrix.os }} Java ${{ matrix.java }} ${{ matrix.javadist }} Python ${{ matrix.python-version }}/ ${{ matrix.test_mode}}
5859
steps:
5960
- name: Checkout Repository
6061
uses: actions/checkout@v4
@@ -116,7 +117,6 @@ jobs:
116117
librosa \
117118
h5py \
118119
gensim \
119-
black \
120120
opt-einsum \
121121
nltk
122122
@@ -125,38 +125,29 @@ jobs:
125125
cd src/main/python
126126
python create_python_dist.py
127127
128-
- name: Run all python tests
128+
- name: Run tests with env
129+
if: ${{ matrix.test_mode == 'env' }}
129130
run: |
130131
export SYSTEMDS_ROOT=$(pwd)
131132
export PATH=$SYSTEMDS_ROOT/bin:$PATH
132133
export SYSDS_QUIET=1
133134
export LOG4JPROP=$SYSTEMDS_ROOT/src/test/resources/log4j.properties
134135
cd src/main/python
135136
unittest-parallel -t . -s tests -v
136-
# python -m unittest discover -s tests -p 'test_*.py'
137-
echo "Exit Status: " $?
138137
139-
- name: Run all python tests no environment
138+
- name: Run tests no env
139+
if: ${{ matrix.test_mode == 'noenv' }}
140140
run: |
141141
export LOG4JPROP=$(pwd)/src/test/resources/log4j.properties
142142
cd src/main/python
143143
unittest-parallel -t . -s tests -v
144-
# python -m unittest discover -s tests -p 'test_*.py'
145-
echo "Exit Status: " $?
146144
147145
- name: Run Federated Python Tests
146+
if: ${{ matrix.test_mode == 'federated' }}
148147
run: |
149148
export SYSTEMDS_ROOT=$(pwd)
150149
export PATH=$SYSTEMDS_ROOT/bin:$PATH
151150
cd src/main/python
152151
./tests/federated/runFedTest.sh
153152
154-
- name: Check formatting according to Black (src/main/python/systemds)
155-
run: |
156-
black --check --exclude operator/algorithm src/main/python/systemds
157-
158-
- name: Check formatting according to Black (src/main/python/tests)
159-
run: |
160-
black --check src/main/python/tests
161-
162153
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#-------------------------------------------------------------
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
#-------------------------------------------------------------
21+
22+
name: Python Black Format Check
23+
24+
on:
25+
push:
26+
paths:
27+
- 'src/main/python/**'
28+
branches:
29+
- main
30+
pull_request:
31+
paths:
32+
- 'src/main/python/**'
33+
branches:
34+
- main
35+
36+
jobs:
37+
black:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Checkout Repository
41+
uses: actions/checkout@v4
42+
43+
- name: Setup Python
44+
uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.x'
47+
48+
- name: Install Black
49+
run: |
50+
pip install --upgrade pip
51+
pip install black
52+
53+
- name: Run Black Check
54+
run: |
55+
black --check --exclude operator/algorithm \
56+
src/main/python/systemds src/main/python/tests

src/main/python/systemds/context/systemds_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ class DynamicStderrHandler(logging.StreamHandler):
965965
def __init__(self, level=logging.NOTSET, formatter=None):
966966
# Avoid setting stream directly to sys.stderr, we will do that dynamically
967967
# For more info see test case: tests/basics/test_context_creation/test_random_port_debug3
968-
# where we redirect the err channel in between different contexts
968+
# where we redirect the err channel between different contexts
969969
super().__init__(stream=None)
970970
self.setLevel(level)
971971
if formatter:

0 commit comments

Comments
 (0)