Skip to content

Commit

Permalink
Fix utils to work with pathlib
Browse files Browse the repository at this point in the history
Also added an autotest for it
  • Loading branch information
Gagi2k authored and rgriebl committed Aug 1, 2024
1 parent ebf29af commit 800579a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion qface/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ def load_filters(path):
ctx = {
'filters': {}
}
exec(path.text(), ctx)
exec(path.read_text(), ctx)
return ctx['filters']

5 changes: 5 additions & 0 deletions tests/test_generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from qface.generator import FileSystem, Generator
from qface.utils import load_filters
from unittest.mock import patch
from io import StringIO
import logging
Expand Down Expand Up @@ -43,6 +44,10 @@ def test_parse_document():
system = FileSystem.parse(inputPath / 'com.pelagicore.ivi.tuner.qface')
assert system.lookup('com.pelagicore.ivi.tuner')

def test_extra_filters():
system = FileSystem.parse(inputPath / 'com.pelagicore.ivi.tuner.qface')
load_filters(Path('tests/templates/filters.py'))
assert system.lookup('com.pelagicore.ivi.tuner')

def test_parse_document_list():
src = [inputPath / 'com.pelagicore.ivi.tuner.qface',
Expand Down

0 comments on commit 800579a

Please sign in to comment.