From 13192b38c09a0eed986efe0e06695a8bae505c83 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Feb 2026 09:23:03 +0000 Subject: [PATCH 1/3] Initial plan From d307c8a65b992bb8a31b2dc832223621c7ea6ee3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Feb 2026 09:25:32 +0000 Subject: [PATCH 2/3] Refactor tests to use pytest tmp_path fixture instead of writing to repository Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com> --- tests/test_adiftools.py | 45 ++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/tests/test_adiftools.py b/tests/test_adiftools.py index af0a20f..49230b8 100644 --- a/tests/test_adiftools.py +++ b/tests/test_adiftools.py @@ -1,7 +1,5 @@ import pytest -import tempfile -from pathlib import Path -from typing import Any, Generator +from typing import Any from adiftools import adiftools @@ -22,16 +20,6 @@ def prep_data(): return df -@pytest.fixture(scope='function') -def txt_file() -> Generator[Path, Any, None]: - ''' csv tempfile ''' - path = Path(tempfile.NamedTemporaryFile(suffix='.txt', delete=False).name) - yield path - - # delete tempfile after test - path.unlink() - - def test_read_adi(prep_data): ''' test adif DataFrame ''' assert prep_data.shape == (126, 14) @@ -42,28 +30,32 @@ def test_read_adi(prep_data): 'MY_GRIDSQUARE', 'COMMENT', 'GRIDSQUARE'] -def test_to_adi(prep_instance): - prep_instance.to_adi('tests/sample_out.adi') - assert True +def test_to_adi(prep_instance, tmp_path): + out = tmp_path / 'sample_out.adi' + prep_instance.to_adi(str(out)) + assert out.exists() -def test_plot_monthly(prep_instance): - prep_instance.plot_monthly('tests/monthly_qso_test.png') - assert True +def test_plot_monthly(prep_instance, tmp_path): + out = tmp_path / 'monthly_qso_test.png' + prep_instance.plot_monthly(str(out)) + assert out.exists() -def test_plot_band_percentage(prep_instance): - prep_instance.plot_band_percentage('tests/percentage_band_test.png') - assert True +def test_plot_band_percentage(prep_instance, tmp_path): + out = tmp_path / 'percentage_band_test.png' + prep_instance.plot_band_percentage(str(out)) + assert out.exists() def test_number_of_records(prep_instance): assert prep_instance.number_of_records == 126 -def test_call_to_txt(prep_instance, txt_file): - prep_instance.call_to_txt(txt_file) - assert True +def test_call_to_txt(prep_instance, tmp_path): + out = tmp_path / 'calls.txt' + prep_instance.call_to_txt(str(out)) + assert out.exists() @pytest.mark.parametrize( @@ -205,6 +197,3 @@ def test_error_is_ja(callsign, expected): ) def test_get_area_num(callsign, expected): assert expected == adiftools.get_area(callsign) - - -# TODO: use test fixture to create a temporary file From 813fd2462bc0b7e2559872488dfcb7a342056196 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 14 Feb 2026 09:26:08 +0000 Subject: [PATCH 3/3] Remove unused typing.Any import Co-authored-by: JS2IIU-MH <146515386+JS2IIU-MH@users.noreply.github.com> --- tests/test_adiftools.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_adiftools.py b/tests/test_adiftools.py index 49230b8..03ea185 100644 --- a/tests/test_adiftools.py +++ b/tests/test_adiftools.py @@ -1,5 +1,4 @@ import pytest -from typing import Any from adiftools import adiftools