Skip to content

Commit 7a47e70

Browse files
committed
Make test pytest compatible
1 parent 919a69e commit 7a47e70

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ recursive-include pylatex *.py
33
recursive-include python2_source/pylatex *.py
44
include versioneer.py
55
include examples/kitten.jpg
6+
include examples/sample-logo.png

tests/test_tabular.py

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env python
2+
import os.path as osp
23

34
from pylatex import Document, MultiColumn, Section, StandAloneGraphic, Tabular
45

56
# This file contains function that test several Tabular related functionality.
67

78

8-
def test_tabular_can_add_row_passing_many_arguments(sample_logo_path):
9+
def test_tabular_can_add_row_passing_many_arguments():
910
"""
1011
Test that Tabular can add a row as described in the function body:
1112
The first method is to pass the content of each cell as a separate argument.
@@ -16,6 +17,7 @@ def test_tabular_can_add_row_passing_many_arguments(sample_logo_path):
1617
1718
"""
1819
doc = Document()
20+
sample_logo_path = osp.join(__file__[0:-15], "..", "examples", "sample-logo.png")
1921

2022
with doc.create(Section("Can Add Row Passing Many Arguments")):
2123
with doc.create(Tabular("|c|c|", booktabs=True)) as table:
@@ -30,7 +32,7 @@ def test_tabular_can_add_row_passing_many_arguments(sample_logo_path):
3032
doc.generate_pdf(clean_tex=False)
3133

3234

33-
def test_tabular_can_add_row_passing_iterable(sample_logo_path):
35+
def test_tabular_can_add_row_passing_iterable():
3436
"""
3537
Test that Tabular can add a row as described in the function body:
3638
The second method
@@ -44,6 +46,7 @@ def test_tabular_can_add_row_passing_iterable(sample_logo_path):
4446
"""
4547
doc = Document()
4648

49+
sample_logo_path = osp.join(__file__[0:-15], "..", "examples", "sample-logo.png")
4750
with doc.create(Section("Can Add Row Passing Iterable")):
4851
with doc.create(Tabular("|c|c|", booktabs=True)) as table:
4952
multi_columns_array = [
@@ -57,14 +60,3 @@ def test_tabular_can_add_row_passing_iterable(sample_logo_path):
5760

5861
table.add_row(multi_columns_array)
5962
doc.generate_pdf()
60-
61-
62-
if __name__ == "__main__":
63-
import os.path as osp
64-
65-
sample_logo_path = osp.abspath(
66-
osp.join(__file__[0:-15], "..", "examples", "sample-logo.png")
67-
)
68-
69-
test_tabular_can_add_row_passing_many_arguments(sample_logo_path=sample_logo_path)
70-
test_tabular_can_add_row_passing_iterable(sample_logo_path=sample_logo_path)

0 commit comments

Comments
 (0)