1212from 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' )
1720def 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
4144def 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])
5962def 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])
8285def 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])
101104def 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' )
0 commit comments