Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINT] Fixing Unit Tests for Python 3.11 and 3.12 support #800

Merged
merged 9 commits into from
Jun 27, 2024
2 changes: 1 addition & 1 deletion .github/workflows/unix_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
strategy:
matrix:
os: [ubuntu-latest,macos-latest]
python-version: [3.8, 3.9, '3.10']
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]
python-version: [3.8, 3.11, 3.12]

Really great work getting this working @kmilo9999!

As per our discussion, I think these will be the versions we stick with for now. Definitely will be keeping in mind the idea of having a separate branch for testing the full matrix in the future

Copy link
Collaborator

@gtdang gtdang Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice catch. I was discussing with a colleague that one possibility is to have a separate full-matrix workflow that tests the main branch as a cron job. You can set up a workflow to run on a monthly or 2-week basis or something.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I remove 3.9 and 3.10 from the windows workflow too?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: [windows-latest]
python-version: [3.8, 3.9, '3.10']
python-version: [3.8, 3.9, '3.10', 3.11, 3.12]

steps:
- uses: actions/checkout@v4
Expand Down
16 changes: 8 additions & 8 deletions hnn_core/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,18 @@ def __init__(self, theme_color="#8A2BE2",
"btn_full_w": Layout(height=f"{button_height}px", width='100%'),
"del_fig_btn": Layout(height=f"{button_height}px", width='auto'),
"log_out": Layout(border='1px solid gray',
height=f"{log_window_height-10}px",
height=f"{log_window_height - 10}px",
overflow='auto'),
"viz_config": Layout(width='99%'),
"simulations_list": Layout(width=f'{left_sidebar_width-50}px'),
"simulations_list": Layout(width=f'{left_sidebar_width - 50}px'),
"visualization_window": Layout(
width=f"{viz_win_width-10}px",
height=f"{main_content_height-10}px",
width=f"{viz_win_width - 10}px",
height=f"{main_content_height - 10}px",
border='1px solid gray',
overflow='scroll'),
"visualization_output": Layout(
width=f"{viz_win_width-50}px",
height=f"{main_content_height-100}px",
width=f"{viz_win_width - 50}px",
height=f"{main_content_height - 100}px",
border='1px solid gray',
overflow='scroll'),
"left_sidebar": Layout(width=f"{left_sidebar_width}px",
Expand All @@ -179,7 +179,7 @@ def __init__(self, theme_color="#8A2BE2",
flex_wrap="wrap",
),
"config_box": Layout(width=f"{left_sidebar_width}px",
height=f"{config_box_height-100}px"),
height=f"{config_box_height - 100}px"),
"drive_widget": Layout(width="auto"),
"drive_textbox": Layout(width='270px', height='auto'),
# simulation status related
Expand Down Expand Up @@ -1566,7 +1566,7 @@ def _create_zip(csv_data_list, simulation_name):
with io.BytesIO() as zip_buffer:
with zipfile.ZipFile(zip_buffer, 'w', zipfile.ZIP_DEFLATED) as zf:
for index, csv_data in enumerate(csv_data_list):
zf.writestr(f'{simulation_name}_{index+1}.csv', csv_data)
zf.writestr(f'{simulation_name}_{index + 1}.csv', csv_data)
zip_buffer.seek(0)
return zip_buffer.read()

Expand Down
4 changes: 2 additions & 2 deletions hnn_core/tests/test_drives.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_external_drive_times():
events_per_cycle = 5
cycle_events_isi = 20
with pytest.raises(ValueError,
match=r'Burst duration (?s).* cannot be greater than'):
match=r'(?s)Burst duration .* cannot be greater than'):
_create_bursty_input(t0=t0, t0_stdev=t0_stdev,
tstop=tstop, f_input=f_input,
events_jitter_std=events_jitter_std,
Expand Down Expand Up @@ -339,7 +339,7 @@ def test_add_drives():
net.add_bursty_drive('bursty_drive', tstart=10, tstop=1,
location='distal', burst_rate=10)

msg = (r'Burst duration (?s).* cannot be greater than '
msg = (r'(?s)Burst duration .* cannot be greater than '
'burst period')
with pytest.raises(ValueError, match=msg):
net.add_bursty_drive('bursty_drive', location='distal',
Expand Down
6 changes: 4 additions & 2 deletions hnn_core/tests/test_extracellular.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ def test_extracellular_api():
# all remaining input arguments checked by ExtracellularArray

rec_arr = ExtracellularArray(electrode_pos)
with pytest.raises(AttributeError, match="can't set attribute"):
with pytest.raises(AttributeError,
match="has no setter|can't set attribute"):
gtdang marked this conversation as resolved.
Show resolved Hide resolved
rec_arr.times = [1, 2, 3]
with pytest.raises(AttributeError, match="can't set attribute"):
with pytest.raises(AttributeError,
match="has no setter|can't set attribute"):
rec_arr.voltages = [1, 2, 3]
with pytest.raises(TypeError, match="trial index must be int"):
_ = rec_arr['0']
Expand Down
Loading