test_cli_sdk.py 17.2 KB
Newer Older
yyy's avatar
yyy committed
1
2
3
4
5
6
"""test cli and sdk."""
import logging
import os
import pytest
from conf import conf
from lib import common
yyy's avatar
yyy committed
7
import time
yyy's avatar
yyy committed
8
9
10
import magic_pdf.model as model_config
from magic_pdf.pipe.UNIPipe import UNIPipe
from magic_pdf.rw.DiskReaderWriter import DiskReaderWriter
quyuan's avatar
quyuan committed
11
from magic_pdf.rw.S3ReaderWriter import S3ReaderWriter
yyy's avatar
yyy committed
12
13
14
15
model_config.__use_inside_model__ = True
pdf_res_path = conf.conf['pdf_res_path']
code_path = conf.conf['code_path']
pdf_dev_path = conf.conf['pdf_dev_path']
quyuan's avatar
quyuan committed
16
magic_pdf_config = "/home/quyuan/magic-pdf.json"
yyy's avatar
yyy committed
17
18
19

class TestCli:
    """test cli."""
quyuan's avatar
quyuan committed
20
21
22
23
24
25
26
27
28
    @pytest.fixture(autouse=True)
    def setup(self):
        """
        init
        """
        common.clear_gpu_memory()
        common.update_config_file(magic_pdf_config, "device-mode", "cuda")
        # 这里可以添加任何前置操作
        yield
yyy's avatar
yyy committed
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

    @pytest.mark.P0
    def test_pdf_auto_sdk(self):
        """pdf sdk auto test."""
        demo_names = list()
        pdf_path = os.path.join(pdf_dev_path, 'pdf')
        for pdf_file in os.listdir(pdf_path):
            if pdf_file.endswith('.pdf'):
                demo_names.append(pdf_file.split('.')[0])
        for demo_name in demo_names:
            pdf_path = os.path.join(pdf_dev_path, 'pdf', f'{demo_name}.pdf')
            print(pdf_path)
            pdf_bytes = open(pdf_path, 'rb').read()
            local_image_dir = os.path.join(pdf_dev_path, 'pdf', 'images')
            image_dir = str(os.path.basename(local_image_dir))
            image_writer = DiskReaderWriter(local_image_dir)
            model_json = list()
            jso_useful_key = {'_pdf_type': '', 'model_list': model_json}
            pipe = UNIPipe(pdf_bytes, jso_useful_key, image_writer)
            pipe.pipe_classify()
            if len(model_json) == 0:
                if model_config.__use_inside_model__:
                    pipe.pipe_analyze()
                else:
                    exit(1)
            pipe.pipe_parse()
            md_content = pipe.pipe_mk_markdown(image_dir, drop_mode='none')
            dir_path = os.path.join(pdf_dev_path, 'mineru')
            if not os.path.exists(dir_path):
                os.makedirs(dir_path, exist_ok=True)
            res_path = os.path.join(dir_path, f'{demo_name}.md')
            common.delete_file(res_path)
            with open(res_path, 'w+', encoding='utf-8') as f:
                f.write(md_content)
            common.sdk_count_folders_and_check_contents(res_path)

    @pytest.mark.P0
    def test_pdf_ocr_sdk(self):
        """pdf sdk ocr test."""
yyy's avatar
yyy committed
68
        time.sleep(2)
yyy's avatar
yyy committed
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
        demo_names = list()
        pdf_path = os.path.join(pdf_dev_path, 'pdf')
        for pdf_file in os.listdir(pdf_path):
            if pdf_file.endswith('.pdf'):
                demo_names.append(pdf_file.split('.')[0])
        for demo_name in demo_names:
            pdf_path = os.path.join(pdf_dev_path, 'pdf', f'{demo_name}.pdf')
            print(pdf_path)
            pdf_bytes = open(pdf_path, 'rb').read()
            local_image_dir = os.path.join(pdf_dev_path, 'pdf', 'images')
            image_dir = str(os.path.basename(local_image_dir))
            image_writer = DiskReaderWriter(local_image_dir)
            model_json = list()
            jso_useful_key = {'_pdf_type': 'ocr', 'model_list': model_json}
            pipe = UNIPipe(pdf_bytes, jso_useful_key, image_writer)
            pipe.pipe_classify()
            if len(model_json) == 0:
                if model_config.__use_inside_model__:
                    pipe.pipe_analyze()
                else:
                    exit(1)
            pipe.pipe_parse()
            md_content = pipe.pipe_mk_markdown(image_dir, drop_mode='none')
            dir_path = os.path.join(pdf_dev_path, 'mineru')
            if not os.path.exists(dir_path):
                os.makedirs(dir_path, exist_ok=True)
            res_path = os.path.join(dir_path, f'{demo_name}.md')
            common.delete_file(res_path)
            with open(res_path, 'w+', encoding='utf-8') as f:
                f.write(md_content)
            common.sdk_count_folders_and_check_contents(res_path)
yyy's avatar
yyy committed
100
    
yyy's avatar
yyy committed
101
102
103
    @pytest.mark.P0
    def test_pdf_txt_sdk(self):
        """pdf sdk txt test."""
yyy's avatar
yyy committed
104
        time.sleep(2)
yyy's avatar
yyy committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
        demo_names = list()
        pdf_path = os.path.join(pdf_dev_path, 'pdf')
        for pdf_file in os.listdir(pdf_path):
            if pdf_file.endswith('.pdf'):
                demo_names.append(pdf_file.split('.')[0])
        for demo_name in demo_names:
            pdf_path = os.path.join(pdf_dev_path, 'pdf', f'{demo_name}.pdf')
            pdf_bytes = open(pdf_path, 'rb').read()
            local_image_dir = os.path.join(pdf_dev_path, 'pdf', 'images')
            image_dir = str(os.path.basename(local_image_dir))
            image_writer = DiskReaderWriter(local_image_dir)
            model_json = list()
            jso_useful_key = {'_pdf_type': 'txt', 'model_list': model_json}
            pipe = UNIPipe(pdf_bytes, jso_useful_key, image_writer)
            pipe.pipe_classify()
            if len(model_json) == 0:
                if model_config.__use_inside_model__:
                    pipe.pipe_analyze()
                else:
                    exit(1)
            pipe.pipe_parse()
            md_content = pipe.pipe_mk_markdown(image_dir, drop_mode='none')
            dir_path = os.path.join(pdf_dev_path, 'mineru')
            if not os.path.exists(dir_path):
                os.makedirs(dir_path, exist_ok=True)
            res_path = os.path.join(dir_path, f'{demo_name}.md')
            common.delete_file(res_path)
            with open(res_path, 'w+', encoding='utf-8') as f:
                f.write(md_content)
            common.sdk_count_folders_and_check_contents(res_path)
yyy's avatar
yyy committed
135
    
yyy's avatar
yyy committed
136
137
138
    @pytest.mark.P0
    def test_pdf_cli_auto(self):
        """magic_pdf cli test auto."""
yyy's avatar
yyy committed
139
        time.sleep(2)
yyy's avatar
yyy committed
140
141
142
143
144
145
146
147
148
149
150
151
152
153
        demo_names = []
        pdf_path = os.path.join(pdf_dev_path, 'pdf')
        for pdf_file in os.listdir(pdf_path):
            if pdf_file.endswith('.pdf'):
                demo_names.append(pdf_file.split('.')[0])
        for demo_name in demo_names:
            res_path = os.path.join(pdf_dev_path, 'mineru')
            common.delete_file(res_path)
            cmd = 'magic-pdf -p %s -o %s -m %s' % (os.path.join(
                pdf_path, f'{demo_name}.pdf'), res_path, 'auto')
            logging.info(cmd)
            os.system(cmd)
            common.cli_count_folders_and_check_contents(
                os.path.join(res_path, demo_name, 'auto'))
yyy's avatar
yyy committed
154
   
yyy's avatar
yyy committed
155
    @pytest.mark.P0
yyy's avatar
yyy committed
156
    def test_pdf_cli_txt(self):
yyy's avatar
yyy committed
157
        """magic_pdf cli test txt."""
yyy's avatar
yyy committed
158
        time.sleep(2)
yyy's avatar
yyy committed
159
160
161
162
163
164
165
166
167
168
169
170
171
172
        demo_names = []
        pdf_path = os.path.join(pdf_dev_path, 'pdf')
        for pdf_file in os.listdir(pdf_path):
            if pdf_file.endswith('.pdf'):
                demo_names.append(pdf_file.split('.')[0])
        for demo_name in demo_names:
            res_path = os.path.join(pdf_dev_path, 'mineru')
            common.delete_file(res_path)
            cmd = 'magic-pdf -p %s -o %s -m %s' % (os.path.join(
                pdf_path, f'{demo_name}.pdf'), res_path, 'txt')
            logging.info(cmd)
            os.system(cmd)
            common.cli_count_folders_and_check_contents(
                os.path.join(res_path, demo_name, 'txt'))
yyy's avatar
yyy committed
173
   
yyy's avatar
yyy committed
174
    @pytest.mark.P0
yyy's avatar
yyy committed
175
    def test_pdf_cli_ocr(self):
yyy's avatar
yyy committed
176
        """magic_pdf cli test ocr."""
yyy's avatar
yyy committed
177
        time.sleep(2)
yyy's avatar
yyy committed
178
179
180
181
182
183
184
185
186
187
188
189
190
191
        demo_names = []
        pdf_path = os.path.join(pdf_dev_path, 'pdf')
        for pdf_file in os.listdir(pdf_path):
            if pdf_file.endswith('.pdf'):
                demo_names.append(pdf_file.split('.')[0])
        for demo_name in demo_names:
            res_path = os.path.join(pdf_dev_path, 'mineru')
            common.delete_file(res_path)
            cmd = 'magic-pdf -p %s -o %s -m %s' % (os.path.join(
                pdf_path, f'{demo_name}.pdf'), res_path, 'ocr')
            logging.info(cmd)
            os.system(cmd)
            common.cli_count_folders_and_check_contents(
                os.path.join(res_path, demo_name, 'ocr'))
yyy's avatar
yyy committed
192
193
    
    @pytest.mark.skip(reason='out-of-date api')
quyuan's avatar
quyuan committed
194
195
196
    @pytest.mark.P1
    def test_pdf_dev_cli_local_jsonl_txt(self):
        """magic_pdf_dev cli local txt."""
yyy's avatar
yyy committed
197
        time.sleep(2)
quyuan's avatar
quyuan committed
198
        jsonl_path = os.path.join(pdf_dev_path, 'line1.jsonl')
quyuan's avatar
quyuan committed
199
        cmd = 'magic-pdf-dev --jsonl %s --method %s' % (jsonl_path, "txt")
quyuan's avatar
quyuan committed
200
201
202
        logging.info(cmd)
        os.system(cmd)

yyy's avatar
yyy committed
203
    @pytest.mark.skip(reason='out-of-date api')
quyuan's avatar
quyuan committed
204
205
206
    @pytest.mark.P1
    def test_pdf_dev_cli_local_jsonl_ocr(self):
        """magic_pdf_dev cli local ocr."""
yyy's avatar
yyy committed
207
        time.sleep(2)
quyuan's avatar
quyuan committed
208
        jsonl_path = os.path.join(pdf_dev_path, 'line1.jsonl')
quyuan's avatar
quyuan committed
209
        cmd = 'magic-pdf-dev --jsonl %s --method %s' % (jsonl_path, 'ocr')
quyuan's avatar
quyuan committed
210
211
212
        logging.info(cmd)
        os.system(cmd)

yyy's avatar
yyy committed
213
    @pytest.mark.skip(reason='out-of-date api')
quyuan's avatar
quyuan committed
214
215
216
    @pytest.mark.P1
    def test_pdf_dev_cli_local_jsonl_auto(self):
        """magic_pdf_dev cli local auto."""
yyy's avatar
yyy committed
217
        time.sleep(2)
quyuan's avatar
quyuan committed
218
        jsonl_path = os.path.join(pdf_dev_path, 'line1.jsonl')
quyuan's avatar
quyuan committed
219
        cmd = 'magic-pdf-dev --jsonl %s --method %s' % (jsonl_path, 'auto')
quyuan's avatar
quyuan committed
220
221
        logging.info(cmd)
        os.system(cmd)
yyy's avatar
yyy committed
222
223
    
    @pytest.mark.skip(reason='out-of-date api')
quyuan's avatar
quyuan committed
224
225
226
    @pytest.mark.P1
    def test_pdf_dev_cli_s3_jsonl_txt(self):
        """magic_pdf_dev cli s3 txt."""
yyy's avatar
yyy committed
227
        time.sleep(2)
quyuan's avatar
quyuan committed
228
        jsonl_path = os.path.join(pdf_dev_path, 'line1.jsonl')
quyuan's avatar
quyuan committed
229
        cmd = 'magic-pdf-dev --jsonl %s --method %s' % (jsonl_path, "txt")
quyuan's avatar
quyuan committed
230
231
232
        logging.info(cmd)
        os.system(cmd)

yyy's avatar
yyy committed
233
    @pytest.mark.skip(reason='out-of-date api')
quyuan's avatar
quyuan committed
234
235
236
    @pytest.mark.P1
    def test_pdf_dev_cli_s3_jsonl_ocr(self):
        """magic_pdf_dev cli s3 ocr."""
yyy's avatar
yyy committed
237
        time.sleep(2)
quyuan's avatar
quyuan committed
238
        jsonl_path = os.path.join(pdf_dev_path, 'line1.jsonl')
quyuan's avatar
quyuan committed
239
        cmd = 'magic-pdf-dev --jsonl %s --method %s' % (jsonl_path, 'ocr')
quyuan's avatar
quyuan committed
240
241
242
        logging.info(cmd)
        os.system(cmd)

yyy's avatar
yyy committed
243
    @pytest.mark.skip(reason='out-of-date api')
quyuan's avatar
quyuan committed
244
245
246
    @pytest.mark.P1
    def test_pdf_dev_cli_s3_jsonl_auto(self):
        """magic_pdf_dev cli s3 auto."""
yyy's avatar
yyy committed
247
        time.sleep(2)
quyuan's avatar
quyuan committed
248
249
250
251
252
        jsonl_path = os.path.join(pdf_dev_path, 'line1.jsonl')
        cmd = 'magic-pdf-dev --jsonl %s --method %s' % (jsonl_path, 'auto')
        logging.info(cmd)
        os.system(cmd)

quyuan's avatar
quyuan committed
253
254
255
    @pytest.mark.P1
    def test_pdf_dev_cli_pdf_json_auto(self):
        """magic_pdf_dev cli pdf+json auto."""
yyy's avatar
yyy committed
256
        time.sleep(2)
quyuan's avatar
quyuan committed
257
        json_path = os.path.join(pdf_dev_path, 'test_model.json')
yyy's avatar
yyy committed
258
        pdf_path = os.path.join(pdf_dev_path, 'pdf', 'test_rearch_report.pdf')
quyuan's avatar
quyuan committed
259
260
261
        cmd = 'magic-pdf-dev --pdf %s --json %s --method %s' % (pdf_path, json_path, 'auto')
        logging.info(cmd)
        os.system(cmd)
yyy's avatar
yyy committed
262
263
   
    @pytest.mark.skip(reason='out-of-date api')
quyuan's avatar
quyuan committed
264
265
266
    @pytest.mark.P1
    def test_pdf_dev_cli_pdf_json_ocr(self):
        """magic_pdf_dev cli pdf+json ocr."""
yyy's avatar
yyy committed
267
        time.sleep(2)
quyuan's avatar
quyuan committed
268
        json_path = os.path.join(pdf_dev_path, 'test_model.json')
yyy's avatar
yyy committed
269
        pdf_path = os.path.join(pdf_dev_path, 'pdf', 'test_rearch_report.pdf')
quyuan's avatar
quyuan committed
270
271
272
        cmd = 'magic-pdf-dev --pdf %s --json %s --method %s' % (pdf_path, json_path, 'auto')
        logging.info(cmd)
        os.system(cmd)
yyy's avatar
yyy committed
273
    
quyuan's avatar
quyuan committed
274
275
    @pytest.mark.P1
    def test_s3_sdk_suto(self):
yyy's avatar
yyy committed
276
277
278
279
280
281
        """
        test s3 sdk auto.
        """
        time.sleep(2)
        pdf_ak = os.getenv('pdf_ak')
        print (pdf_ak)
quyuan's avatar
quyuan committed
282
283
284
285
        pdf_sk = os.environ.get('pdf_sk', "")
        pdf_bucket = os.environ.get('bucket', "")
        pdf_endpoint = os.environ.get('pdf_endpoint', "")
        s3_pdf_path = conf.conf["s3_pdf_path"]
yyy's avatar
yyy committed
286
287
        image_dir = "s3://" + pdf_bucket + "/mineru/test/output"
        print (image_dir)
quyuan's avatar
quyuan committed
288
289
290
291
292
293
294
295
296
297
        s3pdf_cli = S3ReaderWriter(pdf_ak, pdf_sk, pdf_endpoint)
        s3image_cli = S3ReaderWriter(pdf_ak, pdf_sk, pdf_endpoint, parent_path=image_dir)
        pdf_bytes = s3pdf_cli.read(s3_pdf_path, mode=s3pdf_cli.MODE_BIN)
        jso_useful_key = {"_pdf_type": "", "model_list": []}
        pipe = UNIPipe(pdf_bytes, jso_useful_key, s3image_cli)
        pipe.pipe_classify()
        pipe.pipe_analyze()
        pipe.pipe_parse()
        md_content = pipe.pipe_mk_markdown(image_dir, drop_mode="none")
        assert len(md_content) > 0
quyuan's avatar
quyuan committed
298

yyy's avatar
yyy committed
299
300
301
302
    @pytest.mark.P1
    def test_local_magic_pdf_open_st_table(self):
        """magic pdf cli open st table."""
        time.sleep(2)
quyuan's avatar
quyuan committed
303
304
305
306
307
308
309
        #pre_cmd = "cp ~/magic_pdf_st.json ~/magic-pdf.json"
        value = {
        "model": "struct_eqtable",
        "enable": True,
        "max_time": 400
        }   
        common.update_config_file(magic_pdf_config, "table-config", value)
yyy's avatar
yyy committed
310
311
312
313
        pdf_path = os.path.join(pdf_dev_path, "pdf", "test_rearch_report.pdf")
        common.delete_file(pdf_res_path)
        cli_cmd = "magic-pdf -p %s -o %s" % (pdf_path, pdf_res_path)
        os.system(cli_cmd)
quyuan's avatar
quyuan committed
314
        res = common.check_html_table_exists(os.path.join(pdf_res_path, "test_rearch_report", "auto", "test_rearch_report.md"))
yyy's avatar
yyy committed
315
316
317
        assert res is True
  
    @pytest.mark.P1
quyuan's avatar
quyuan committed
318
319
    def test_local_magic_pdf_open_tablemaster_cuda(self):
        """magic pdf cli open table master html table cuda mode."""
yyy's avatar
yyy committed
320
        time.sleep(2)
quyuan's avatar
quyuan committed
321
322
323
324
325
326
327
328
        #pre_cmd = "cp ~/magic_pdf_html.json ~/magic-pdf.json"
        #os.system(pre_cmd)
        value = {
        "model": "tablemaster",
        "enable": True,
        "max_time": 400
        }   
        common.update_config_file(magic_pdf_config, "table-config", value)
yyy's avatar
yyy committed
329
330
331
332
333
334
335
336
        pdf_path = os.path.join(pdf_dev_path, "pdf", "test_rearch_report.pdf")
        common.delete_file(pdf_res_path)
        cli_cmd = "magic-pdf -p %s -o %s" % (pdf_path, pdf_res_path)
        os.system(cli_cmd)
        res = common.check_html_table_exists(os.path.join(pdf_res_path, "test_rearch_report", "auto", "test_rearch_report.md"))
        assert res is True
    
    @pytest.mark.P1
quyuan's avatar
quyuan committed
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
    def test_local_magic_pdf_open_rapidai_table(self):
        """magic pdf cli open rapid ai table."""
        time.sleep(2)
        #pre_cmd = "cp ~/magic_pdf_html.json ~/magic-pdf.json"
        #os.system(pre_cmd)
        value = {
        "model": "rapid_table",
        "enable": True,
        "max_time": 400
        }   
        common.update_config_file(magic_pdf_config, "table-config", value)
        pdf_path = os.path.join(pdf_dev_path, "pdf", "test_rearch_report.pdf")
        common.delete_file(pdf_res_path)
        cli_cmd = "magic-pdf -p %s -o %s" % (pdf_path, pdf_res_path)
        os.system(cli_cmd)
        res = common.check_html_table_exists(os.path.join(pdf_res_path, "test_rearch_report", "auto", "test_rearch_report.md"))
        assert res is True
    
    
    @pytest.mark.P1
    def test_local_magic_pdf_doclayout_yolo(self):
        """magic pdf cli open doclyaout yolo."""
        time.sleep(2)
        #pre_cmd = "cp ~/magic_pdf_html.json ~/magic-pdf.json"
        #os.system(pre_cmd)
        value = {
        "model": "doclayout_yolo"
        }   
        common.update_config_file(magic_pdf_config, "layout-config", value)
        pdf_path = os.path.join(pdf_dev_path, "pdf", "test_rearch_report.pdf")
        common.delete_file(pdf_res_path)
        cli_cmd = "magic-pdf -p %s -o %s" % (pdf_path, pdf_res_path)
        os.system(cli_cmd)
        common.cli_count_folders_and_check_contents(os.path.join(pdf_res_path, "test_rearch_report", "auto"))

    @pytest.mark.P1
    def test_local_magic_pdf_layoutlmv3_yolo(self):
        """magic pdf cli open layoutlmv3."""
        time.sleep(2)
        value = {
        "model": "layoutlmv3"
        }   
        common.update_config_file(magic_pdf_config, "layout-config", value)
        pdf_path = os.path.join(pdf_dev_path, "pdf", "test_rearch_report.pdf")
        common.delete_file(pdf_res_path)
        cli_cmd = "magic-pdf -p %s -o %s" % (pdf_path, pdf_res_path)
        os.system(cli_cmd)
        common.cli_count_folders_and_check_contents(os.path.join(pdf_res_path, "test_rearch_report", "auto"))
        #res = common.check_html_table_exists(os.path.join(pdf_res_path, "test_rearch_report", "auto", "test_rearch_report.md"))

    @pytest.mark.P1
quyuan's avatar
quyuan committed
388
389
    def test_magic_pdf_cpu(self):
        """magic pdf cli cpu mode."""
yyy's avatar
yyy committed
390
        time.sleep(2)
quyuan's avatar
quyuan committed
391
392
393
394
        #pre_cmd = "cp ~/magic_pdf_html_table_cpu.json ~/magic-pdf.json"
        #os.system(pre_cmd)
        value = {
        "model": "tablemaster",
quyuan's avatar
quyuan committed
395
        "enable": False,
quyuan's avatar
quyuan committed
396
397
398
399
        "max_time": 400
        }   
        common.update_config_file(magic_pdf_config, "table-config", value)
        common.update_config_file(magic_pdf_config, "device-mode", "cpu")
yyy's avatar
yyy committed
400
401
402
403
        pdf_path = os.path.join(pdf_dev_path, "pdf", "test_rearch_report.pdf")
        common.delete_file(pdf_res_path)
        cli_cmd = "magic-pdf -p %s -o %s" % (pdf_path, pdf_res_path)
        os.system(cli_cmd)
quyuan's avatar
quyuan committed
404
        common.cli_count_folders_and_check_contents(os.path.join(pdf_res_path, "test_rearch_report", "auto"))
yyy's avatar
yyy committed
405

quyuan's avatar
quyuan committed
406

yyy's avatar
yyy committed
407
408
409
410
    @pytest.mark.P1
    def test_local_magic_pdf_close_html_table(self):
        """magic pdf cli close table."""
        time.sleep(2)
quyuan's avatar
quyuan committed
411
412
413
414
415
416
417
418
        #pre_cmd = "cp ~/magic_pdf_close_table.json ~/magic-pdf.json"
        #os.system(pre_cmd)
        value = {
        "model": "tablemaster",
        "enable": False,
        "max_time": 400
        }   
        common.update_config_file(magic_pdf_config, "table-config", value)
yyy's avatar
yyy committed
419
420
421
422
423
424
425
        pdf_path = os.path.join(pdf_dev_path, "pdf", "test_rearch_report.pdf")
        common.delete_file(pdf_res_path)
        cli_cmd = "magic-pdf -p %s -o %s" % (pdf_path, pdf_res_path)
        os.system(cli_cmd)
        res = common.check_close_tables(os.path.join(pdf_res_path, "test_rearch_report", "auto", "test_rearch_report.md"))
        assert res is True
    
quyuan's avatar
quyuan committed
426

yyy's avatar
yyy committed
427
 
yyy's avatar
yyy committed
428
429
if __name__ == '__main__':
    pytest.main()