-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.txt
115 lines (99 loc) · 4.62 KB
/
test.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
============================= test session starts =============================
platform win32 -- Python 3.5.1, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: D:\git\cbr-db, inifile: pytest.ini
plugins: cov-2.2.0, mock-0.11.0
collected 49 items
test.txt s
tests\test_bankform.py ..
tests\test_cli_dates.py ....
tests\test_commands.py F
tests\test_conn.py ..
tests\test_database.py .
tests\test_download.py ..
tests\test_filesystem.py ...
tests\test_make_url.py ...
tests\test_select_regn.py ....
tests\test_unpack.py .F.
tests\test_utils_dates.py .......................
================================== FAILURES ===================================
______________________________ test_dbf2csv[101] ______________________________
mocker = <pytest_mock.MockFixture object at 0x00000281EB0A5DD8>
tempdir = 'C:\\Users\\B7E3~1\\AppData\\Local\\Temp\\cbr-db-tests\\dbf2csv\\101'
form = '101'
@pytest.mark.parametrize('form', ['101'])
def test_dbf2csv(mocker, tempdir, form):
tempdir = os.path.join(tempdir, 'dbf2csv', form)
form_dir = os.path.join(FILES_DIR, 'dbf2csv', form)
dbf_dir = copy_and_unpack(
os.path.join(form_dir, 'dbf'),
os.path.join(tempdir, 'dbf')
)
expected_csv_dir = copy_and_unpack(
os.path.join(form_dir, 'csv'),
os.path.join(tempdir, 'expected-csv')
)
output_csv_dir = os.path.join(tempdir, 'csv')
if not os.path.isdir(output_csv_dir):
os.makedirs(output_csv_dir)
def get_public_data_folder_mock(form, ext):
assert form == '101'
if ext == 'dbf':
return dbf_dir
elif ext == 'csv':
return output_csv_dir
assert False, 'Unexpected ext: {!r}'.format(ext)
mocker.patch('cbr_db.commands.get_public_data_folder',
get_public_data_folder_mock)
dbf2csv('2015-12-20', '101')
> compare_dirs(output_csv_dir, expected_csv_dir)
tests\test_commands.py:37:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests\conftest.py:30: in compare_dirs
_assert_equal_dirs(filecmp.dircmp(a, b))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmp = <filecmp.dircmp object at 0x00000281EB120DA0>
def _assert_equal_dirs(cmp):
> assert cmp.diff_files == []
E assert ['bulk_f101b1...1_b.112015_B'] == []
E Left contains more items, first extra item: 'bulk_f101b1.112015B1'
E Use -v to get the full diff
tests\conftest.py:34: AssertionError
---------------------------- Captured stdout call -----------------------------
Converting 112015_B.DBF to csv file bulk_f101_b.112015_B
Time elapsed: 0:00:00.017011
Converting 112015B1.DBF to csv file bulk_f101b1.112015B1
Time elapsed: 0:00:02.793979
Skipped writing 5172 records to file.
___________________ test_unpack_path[101-20051201.zip-101] ____________________
mocker = <pytest_mock.MockFixture object at 0x00000281EB17BB70>
tempdir = 'C:\\Users\\B7E3~1\\AppData\\Local\\Temp\\cbr-db-tests'
filename = '101-20051201.zip', form = '101'
@pytest.mark.parametrize('filename,form', [
('101-20051201.zip', '101'),
('101-20151201.rar', '101')
])
def test_unpack_path(mocker, tempdir, filename, form):
test_path = os.path.join(FILES_DIR, 'unpack', os.path.splitext(filename)[0])
input_path = os.path.join(test_path, 'input', filename)
expected_output_dir = os.path.join(test_path, 'output')
temp_input_path = os.path.join(tempdir, os.path.relpath(input_path, FILES_DIR))
os.makedirs(os.path.dirname(temp_input_path))
shutil.copy(input_path, temp_input_path)
# Unpack into output_dir (in temp)
output_dir = os.path.join(tempdir, os.path.relpath(expected_output_dir, FILES_DIR))
mocker.patch('cbr_db.unpack.get_public_data_folder', return_value=output_dir)
unpack_path(temp_input_path, form)
> compare_dirs(expected_output_dir, output_dir)
tests\test_unpack.py:36:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests\conftest.py:30: in compare_dirs
_assert_equal_dirs(filecmp.dircmp(a, b))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmp = <filecmp.dircmp object at 0x00000281EB17A3C8>
def _assert_equal_dirs(cmp):
> assert cmp.diff_files == []
E assert ['112005_S.DB...112005_B.DBF'] == []
E Left contains more items, first extra item: '112005_S.DBF'
E Use -v to get the full diff
tests\conftest.py:34: AssertionError
=============== 2 failed, 46 passed, 1 skipped in 50.06 seconds ===============