Skip to content
This repository was archived by the owner on Dec 26, 2025. It is now read-only.

Commit 204359f

Browse files
committed
Fixed tests to use abspath
1 parent 3059cbd commit 204359f

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

test/test_dumpadi.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
import adif_file
55

66

7+
def get_file_path(file):
8+
return os.path.join(os.path.dirname(__file__), file)
9+
10+
711
class DumpADI(unittest.TestCase):
812
def test_10_pack_header_tag(self):
913
self.assertEqual('<PROGRAMID:8>Testprog', adif_file.pack('PROGRAMID', 'Testprog'))
@@ -108,7 +112,7 @@ def test_30_dump_a_file(self):
108112
<TEST1:5>test3 <TEST2:5>test4
109113
<EOR>'''
110114

111-
temp_file = 'testdata/~test.adi'
115+
temp_file = get_file_path('testdata/~test.adi')
112116

113117
adif_file.dump_adi(temp_file, adi_dict)
114118

test/test_loadadi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,16 @@ def test_20_unpack_record(self):
4747
self.assertDictEqual({'NAME': 'Test'}, adif_file.unpack(adi_rec_name))
4848

4949
def test_50_goodfile(self):
50-
adi_dict = adif_file.load_adi('testdata/goodfile.txt')
50+
adi_dict = adif_file.load_adi(get_file_path('testdata/goodfile.txt'))
5151

5252
self.assertIn('HEADER', adi_dict)
5353
self.assertIn('RECORDS', adi_dict)
5454
self.assertEqual(3, len(adi_dict['HEADER']))
5555
self.assertEqual(5, len(adi_dict['RECORDS']))
5656

5757
def test_55_toomuchheaders(self):
58-
self.assertRaises(adif_file.TooMuchHeadersException, adif_file.load_adi, 'testdata/toomuchheadersfile.txt')
58+
self.assertRaises(adif_file.TooMuchHeadersException, adif_file.load_adi,
59+
get_file_path('testdata/toomuchheadersfile.txt'))
5960

6061

6162
if __name__ == '__main__':

0 commit comments

Comments
 (0)