Skip to content

Commit e42afad

Browse files
test updated
1 parent 992f451 commit e42afad

6 files changed

Lines changed: 20 additions & 172 deletions

File tree

.github/workflows/ci.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
jobs:
1212
test-and-analyze:
1313
name: Test, Analyze & Build Paper
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-latest
1515
permissions:
1616
actions: read
1717
contents: read
@@ -34,12 +34,21 @@ jobs:
3434
with:
3535
python-version: "3.10"
3636

37+
- name: Cache pip dependencies
38+
id: cache-pip
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.cache/pip
42+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'requirements.txt') }}
43+
restore-keys: |
44+
${{ runner.os }}-pip-
45+
3746
- name: Install System Dependencies (Tkinter/XVFB)
3847
run: |
3948
sudo apt-get update
4049
sudo apt-get install -y python3-tk xvfb
4150
42-
- name: Install Python Dependencies
51+
- name: Install Python and Project Dependencies
4352
run: |
4453
python -m pip install --upgrade pip
4554
pip install pytest flake8 pytest-cov
@@ -75,7 +84,7 @@ jobs:
7584
# ------------------------------------------------------------------------
7685
- name: Run All Tests and Generate Reports
7786
run: |
78-
echo "Running tests within a virtual display..."
87+
echo "Running tests with coverage within a virtual display..."
7988
xvfb-run --auto-servernum pytest --cov=. --cov-report=xml --junitxml=junit.xml -o junit_family=legacy tests/
8089
8190
- name: Upload Coverage Report to Codecov

.github/workflows/draft-pdf.yml

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +0,0 @@
1-
name: Draft PDF
2-
on: [push]
3-
4-
jobs:
5-
paper:
6-
runs-on: ubuntu-latest
7-
name: Paper Draft
8-
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v4
11-
- name: Build draft PDF
12-
uses: openjournals/openjournals-draft-action@master
13-
with:
14-
journal: joss
15-
# This should be the path to the paper within your repo.
16-
paper-path: paper/paper.md
17-
- name: Upload
18-
uses: actions/upload-artifact@v4
19-
with:
20-
name: paper
21-
# This is the output path where Pandoc will write the compiled
22-
# PDF. Note, this should be the same directory as the input
23-
# paper.md
24-
path: paper/paper.pdf

.github/workflows/joss_tests.yml

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +0,0 @@
1-
name: Run PICA JOSS Tests
2-
3-
on:
4-
push:
5-
branches: [ "main", "master" ]
6-
pull_request:
7-
branches: [ "main", "master" ]
8-
9-
jobs:
10-
test:
11-
name: automated test
12-
runs-on: ubuntu-latest
13-
14-
steps:
15-
# ------------------------------------------------------------------------
16-
# PHASE 1: SETUP
17-
# ------------------------------------------------------------------------
18-
- name: Checkout repository
19-
uses: actions/checkout@v4
20-
21-
- name: Set up Python 3.10
22-
uses: actions/setup-python@v5
23-
with:
24-
python-version: "3.10"
25-
26-
- name: Cache pip dependencies
27-
id: cache-pip
28-
uses: actions/cache@v4
29-
with:
30-
path: ~/.cache/pip
31-
# The key invalidates the cache if requirements change
32-
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
33-
restore-keys: |
34-
${{ runner.os }}-pip-
35-
36-
- name: Install Dependencies
37-
# Use a dedicated step for installing dependencies.
38-
run: |
39-
python -m pip install --upgrade pip
40-
pip install -e .
41-
pip install pytest flake8 pytest-cov
42-
43-
# ------------------------------------------------------------------------
44-
# PHASE 2: READYMADE TESTS (Standard Industry Checks)
45-
# ------------------------------------------------------------------------
46-
- name: Run Style & Syntax Check (Flake8)
47-
run: |
48-
echo "STEP 1: Checking for critical syntax errors..."
49-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
50-
51-
echo "STEP 2: Checking for code style warnings..."
52-
flake8 . --count --exit-zero --max-complexity=18 --max-line-length=127 --statistics
53-
54-
# ------------------------------------------------------------------------
55-
# PHASE 3: COMBINED TESTS (Generates both coverage and test results)
56-
# ------------------------------------------------------------------------
57-
- name: Run All Tests and Generate Reports
58-
run: |
59-
echo "--------------------------------------"
60-
echo "GOAL: Generate coverage.xml and junit.xml"
61-
62-
# This command runs all tests, generates XML coverage, and JUnit XML.
63-
pytest --cov=. --cov-report=xml --junitxml=junit.xml -o junit_family=legacy tests/
64-
65-
# ------------------------------------------------------------------------
66-
# PHASE 4: CODECOV UPLOADS
67-
# ------------------------------------------------------------------------
68-
- name: Upload Coverage Report (XML)
69-
uses: codecov/codecov-action@v4
70-
with:
71-
token: ${{ secrets.CODECOV_TOKEN }}
72-
files: ./coverage.xml
73-
fail_ci_if_error: true # It's good practice to fail if coverage upload fails.
74-
75-
- name: Upload Test Results to Codecov (JUnit)
76-
if: always() # This ensures test results are uploaded even if previous steps fail.
77-
uses: codecov/test-results-action@v1
78-
with:
79-
token: ${{ secrets.CODECOV_TOKEN }}
80-
files: ./junit.xml
81-
# This step uploads test timing and failure data

.github/workflows/python-app.yml

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +0,0 @@
1-
name: PICA Automation CI
2-
3-
# Trigger on push to main or pull requests
4-
on:
5-
push:
6-
branches: [ "main" ]
7-
pull_request:
8-
branches: [ "main" ]
9-
10-
permissions:
11-
contents: read
12-
13-
jobs:
14-
build:
15-
runs-on: ubuntu-22.04
16-
17-
steps:
18-
# 1. Check out your code
19-
- uses: actions/checkout@v4
20-
21-
# 2. Set up Python 3.10 (Matches your local environment)
22-
- name: Set up Python 3.10
23-
uses: actions/setup-python@v5
24-
with:
25-
python-version: "3.10"
26-
27-
# 3. Install System Dependencies (Required for Tkinter/Matplotlib on Linux)
28-
- name: Install Tkinter System Libs
29-
run: |
30-
sudo apt-get update
31-
sudo apt-get install -y python3-tk xvfb
32-
33-
# 4. Install Your Python Dependencies
34-
- name: Install dependencies
35-
run: |
36-
python -m pip install --upgrade pip
37-
pip install pytest flake8 pytest-cov
38-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
39-
# Install the package itself in editable mode
40-
pip install -e .
41-
42-
# 5. Lint with Flake8 (The "Lite" Check)
43-
# This finds syntax errors and undefined names without running code
44-
- name: Lint with flake8
45-
run: |
46-
# Stop the build if there are Python syntax errors or undefined names
47-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
48-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
49-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
50-
51-
# 6. Run Tests (The "Logic" Check)
52-
# We ignore the visual GUI rendering tests if they are too heavy,
53-
# but since we mocked them, they should run fast!
54-
- name: automated test
55-
run: |
56-
xvfb-run --auto-servernum python -m pytest tests/

pica/lakeshore/T_Control_L350_RangeControl_GUI.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def _populate_right_panel(self, panel):
450450
self.ax_temp = self.figure.add_subplot(211)
451451
self.ax_heater = self.figure.add_subplot(212, sharex=self.ax_temp)
452452

453-
self.line_temp, = self.ax_temp.plot(
453+
self.line_temp = self.ax_temp.plot(
454454
[], [], color=self.CLR_ACCENT_RED, marker='o', markersize=3, linestyle='-')
455455
self.ax_temp.set_ylabel("Temperature (K)")
456456
self.ax_temp.grid(True, linestyle='--', alpha=0.6)
@@ -461,7 +461,7 @@ def _populate_right_panel(self, panel):
461461
top=False,
462462
labelbottom=False)
463463

464-
self.line_heater, = self.ax_heater.plot(
464+
self.line_heater = self.ax_heater.plot(
465465
[], [], color=self.CLR_ACCENT_GOLD, marker='.', markersize=3, linestyle='-')
466466
self.ax_heater.set_xlabel("Time (s)")
467467
self.ax_heater.set_ylabel("Heater Output (%)")
@@ -495,8 +495,8 @@ def start_ramp(self):
495495
self.set_ui_state(running=True)
496496
for key in self.data_storage:
497497
self.data_storage[key].clear()
498-
self.line_temp.set_data([], [])
499-
self.line_heater.set_data([], [])
498+
self.line_temp[0].set_data([], [])
499+
self.line_heater[0].set_data([], [])
500500
self.ax_temp.set_title(f"Ramping to {self.params['setpoint']} K")
501501
self.canvas.draw()
502502

@@ -532,10 +532,10 @@ def _monitoring_loop(self):
532532
self.data_storage['temperature'].append(temp)
533533
self.data_storage['heater'].append(htr_output)
534534

535-
self.line_temp.set_data(
535+
self.line_temp[0].set_data(
536536
self.data_storage['time'],
537537
self.data_storage['temperature'])
538-
self.line_heater.set_data(
538+
self.line_heater[0].set_data(
539539
self.data_storage['time'],
540540
self.data_storage['heater'])
541541

pica/utils/PlotterUtil_GUI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def run_script_process(script_path):
6666
print("-------------------------")
6767

6868

69-
class PlotterApp:
69+
class PlotterAppGUI:
7070
PROGRAM_VERSION = "2.1"
7171
CLR_BG = '#2B3D4F'
7272
CLR_HEADER = '#3A506B'
@@ -1067,5 +1067,5 @@ def check_for_updates(self):
10671067
multiprocessing.freeze_support()
10681068

10691069
root = tk.Tk()
1070-
app = PlotterApp(root)
1070+
app = PlotterAppGUI(root)
10711071
root.mainloop()

0 commit comments

Comments
 (0)