Skip to content

Commit adf9d96

Browse files
mock streamparser
import apertium in setup.py, causes import error, if apertium-streamparser isnt available during installation
1 parent 757f9ec commit adf9d96

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

apertium/installer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def _download_package(package: str) -> None:
115115
execute.check_returncode()
116116

117117
@staticmethod
118-
def _rename_wrappers():
118+
def _rename_wrappers() -> None:
119119
wrapper_name = {
120120
'python3-apertium': '_apertium_core',
121121
'python3-apertium-lex-tools': '_lextools',

setup.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from os import path
33
from setuptools import find_packages, setup # noqa: I202
44
from setuptools.command.install import install
5+
import sys
6+
from unittest.mock import Mock
57

68

79
class PostInstallCommand(install):
@@ -11,6 +13,9 @@ def __init__(self, *args, **kwargs):
1113

1214
@staticmethod
1315
def _post_install():
16+
# mock apertium-streamparser for importing apertium
17+
sys.modules['streamparser'] = Mock()
18+
1419
import apertium
1520
apertium.installer.install_apertium()
1621
apertium.installer.install_module('eng')

0 commit comments

Comments
 (0)