Skip to content

Commit dfd66d1

Browse files
authored
Update test_zip.py
1 parent 452155b commit dfd66d1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Python_part_3_files/tests/test_zip.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
import os
22
import zipfile
33
from zipfile import ZipFile
4+
from .conftest import path_tmp, path_res
45

56

67
def test_create_and_add_archive():
7-
path_tmp = os.path.dirname(os.path.abspath(__file__)) + '/../tmp'
8-
path_res = os.path.dirname(os.path.abspath(__file__)) + '/../resources'
98
file_dir = os.listdir(path_res)
109

11-
with zipfile.ZipFile(path_tmp + '/test.zip', mode='w', \
10+
with zipfile.ZipFile(os.path.join(path_tmp, 'test.zip'), mode='w', \
1211
compression=zipfile.ZIP_DEFLATED) as zf:
1312
for file in file_dir:
1413
add_file = os.path.join(path_res, file)
1514
zf.write(add_file)
1615

1716

1817
def test_read_archive():
19-
path_res = os.path.dirname(os.path.abspath(__file__)) + '/../resources'
20-
path_tmp = os.path.dirname(os.path.abspath(__file__)) + '/../tmp'
21-
with ZipFile(path_tmp + '/test.zip') as zf:
18+
with ZipFile(os.path.join(path_tmp, 'test.zip')) as zf:
2219
filenames = [os.path.basename(file) for file in zf.namelist()]
20+
print(filenames)
21+
print(os.listdir(path_res))
2322
assert filenames == os.listdir(path_res)

0 commit comments

Comments
 (0)