Skip to content

Commit 6560fe6

Browse files
committed
Made test file paths absolute
1 parent c5fb8be commit 6560fe6

File tree

4 files changed

+29
-17
lines changed

4 files changed

+29
-17
lines changed

icon_font_to_png/test/test_command_line.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
from icon_font_to_png import command_line
1010

1111

12+
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
13+
14+
1215
# Tests
1316
def test_list_option(capfd):
1417
"""Test listing CSS icons"""
15-
css_file = os.path.join('files', 'test-foo.css')
16-
ttf_file = os.path.join('files', 'test.ttf') # Required argument
18+
css_file = os.path.join(BASE_DIR, 'files', 'test-foo.css')
19+
ttf_file = os.path.join(BASE_DIR, 'files', 'test.ttf') # Required argument
1720

1821
# No CSS and TTF files
1922
with pytest.raises(SystemExit):
@@ -46,8 +49,8 @@ def test_list_option(capfd):
4649

4750
def test_icon_export(capfd):
4851
"""Test exporting icons (on Font Awesome files)"""
49-
css_file = os.path.join('files', 'font-awesome.css')
50-
ttf_file = os.path.join('files', 'fontawesome-webfont.ttf')
52+
css_file = os.path.join(BASE_DIR, 'files', 'font-awesome.css')
53+
ttf_file = os.path.join(BASE_DIR, 'files', 'fontawesome-webfont.ttf')
5154

5255
# Export none icons
5356
with pytest.raises(SystemExit):
@@ -90,8 +93,8 @@ def test_icon_export(capfd):
9093

9194
def test_filename_option(capfd):
9295
"""Test filename option"""
93-
css_file = os.path.join('files', 'font-awesome.css')
94-
ttf_file = os.path.join('files', 'fontawesome-webfont.ttf')
96+
css_file = os.path.join(BASE_DIR, 'files', 'font-awesome.css')
97+
ttf_file = os.path.join(BASE_DIR, 'files', 'fontawesome-webfont.ttf')
9598

9699
# Export one icon
97100
command_line.run(

icon_font_to_png/test/test_font_awesome.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
from icon_font_to_png import icon_font
1010

1111

12+
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
13+
14+
1215
# Fixtures
1316
@pytest.fixture(scope='module')
1417
def font_awesome():
1518
"""Create a IconFont instance from Font Awesome files"""
16-
css_file = os.path.join('files', 'font-awesome.css')
17-
ttf_file = os.path.join('files', 'fontawesome-webfont.ttf')
19+
css_file = os.path.join(BASE_DIR, 'files', 'font-awesome.css')
20+
ttf_file = os.path.join(BASE_DIR, 'files', 'fontawesome-webfont.ttf')
1821
return icon_font.IconFont(css_file=css_file, ttf_file=ttf_file)
1922

2023

icon_font_to_png/test/test_icon_font.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
from icon_font_to_png import icon_font
1313

1414

15+
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
16+
17+
1518
# Fixtures
1619
@pytest.fixture(scope='module')
1720
def font_awesome():
1821
"""Create a IconFont instance from Font Awesome files"""
19-
css_file = os.path.join('files', 'font-awesome.css')
20-
ttf_file = os.path.join('files', 'fontawesome-webfont.ttf')
22+
css_file = os.path.join(BASE_DIR, 'files', 'font-awesome.css')
23+
ttf_file = os.path.join(BASE_DIR, 'files', 'fontawesome-webfont.ttf')
2124
return icon_font.IconFont(css_file=css_file, ttf_file=ttf_file)
2225

2326

@@ -40,12 +43,12 @@ def test_init():
4043

4144
def test_common_prefix():
4245
"""Test finding out what the common prefix is"""
43-
css_file = os.path.join('files', 'test-foo.css')
46+
css_file = os.path.join(BASE_DIR, 'files', 'test-foo.css')
4447
obj = icon_font.IconFont(css_file=css_file, ttf_file=None,
4548
keep_prefix=True)
4649
assert obj.common_prefix == 'foo-'
4750

48-
css_file = os.path.join('files', 'test.css')
51+
css_file = os.path.join(BASE_DIR, 'files', 'test.css')
4952
obj = icon_font.IconFont(css_file=css_file, ttf_file=None,
5053
keep_prefix=True)
5154
assert obj.common_prefix == ''
@@ -58,7 +61,7 @@ def test_common_prefix():
5861
])
5962
def test_size(font_awesome, image, size):
6063
"""Test size option"""
61-
original_file = os.path.join('files', image)
64+
original_file = os.path.join(BASE_DIR, 'files', image)
6265

6366
font_awesome.export_icon(icon='rocket', size=size)
6467
exported_file = os.path.join('exported', 'rocket.png')
@@ -81,7 +84,7 @@ def test_size(font_awesome, image, size):
8184
])
8285
def test_color(font_awesome, image, color):
8386
"""Test color option"""
84-
original_file = os.path.join('files', image)
87+
original_file = os.path.join(BASE_DIR, 'files', image)
8588

8689
font_awesome.export_icon(icon='rocket', size=16, color=color)
8790
exported_file = os.path.join('exported', 'rocket.png')
@@ -100,7 +103,7 @@ def test_color(font_awesome, image, color):
100103
])
101104
def test_scale(font_awesome, image, scale):
102105
"""Test scale option"""
103-
original_file = os.path.join('files', image)
106+
original_file = os.path.join(BASE_DIR, 'files', image)
104107

105108
font_awesome.export_icon(icon='rocket', size=16, scale=scale)
106109
exported_file = os.path.join('exported', 'rocket.png')

icon_font_to_png/test/test_octicons.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
from icon_font_to_png import icon_font
1010

1111

12+
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
13+
14+
1215
# Fixtures
1316
@pytest.fixture(scope='module')
1417
def octicons():
1518
"""Create a IconFont instance from Octicons files"""
16-
css_file = os.path.join('files', 'octicons.css')
17-
ttf_file = os.path.join('files', 'octicons.ttf')
19+
css_file = os.path.join(BASE_DIR, 'files', 'octicons.css')
20+
ttf_file = os.path.join(BASE_DIR, 'files', 'octicons.ttf')
1821
return icon_font.IconFont(css_file=css_file, ttf_file=ttf_file)
1922

2023

0 commit comments

Comments
 (0)