File tree 3 files changed +13
-0
lines changed
tests/unit_server/strictdoc/server
02_export_document_to_reqif
3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -496,6 +496,14 @@ def release_pyinstaller(context):
496
496
# """
497
497
# Solution found here:
498
498
# https://stackoverflow.com/a/64473931/598057
499
+ #
500
+ # The --hidden-import strictdoc.server.app flag is needed because without
501
+ # it, the following is produced:
502
+ # ERROR: Error loading ASGI app. Could not import
503
+ # module "strictdoc.server.app".
504
+ # Solution found here: https://stackoverflow.com/a/71340437/598057
505
+ # This behavior is not surprising because that's how the uvicorn loads the
506
+ # application separately from the parent process.
499
507
command = f"""
500
508
pip install pyinstaller &&
501
509
pyinstaller
@@ -504,6 +512,7 @@ def release_pyinstaller(context):
504
512
--noconfirm
505
513
--additional-hooks-dir developer/pyinstaller_hooks
506
514
--distpath { path_to_pyi_dist }
515
+ --hidden-import strictdoc.server.app
507
516
--add-data strictdoc/export/html/templates:templates/html
508
517
--add-data strictdoc/export/rst/templates:templates/rst
509
518
--add-data strictdoc/export/html/_static:_static
Original file line number Diff line number Diff line change 2
2
3
3
from fastapi .testclient import TestClient
4
4
5
+ from strictdoc import environment
5
6
from strictdoc .cli .cli_arg_parser import ServerCommandConfig
6
7
from strictdoc .core .project_config import ProjectConfig
7
8
from strictdoc .server .app import create_app
11
12
12
13
def test_get_document ():
13
14
config = ServerCommandConfig (
15
+ environment = environment ,
14
16
input_path = PATH_TO_THIS_TEST_FOLDER ,
15
17
output_path = os .path .join (PATH_TO_THIS_TEST_FOLDER , "output" ),
16
18
reload = False ,
Original file line number Diff line number Diff line change 4
4
5
5
from fastapi .testclient import TestClient
6
6
7
+ from strictdoc import environment
7
8
from strictdoc .cli .cli_arg_parser import ServerCommandConfig
8
9
from strictdoc .core .project_config import ProjectConfig
9
10
from strictdoc .server .app import create_app
@@ -16,6 +17,7 @@ def test_export_document_to_reqif():
16
17
shutil .rmtree (PATH_TO_OUTPUT_FOLDER , ignore_errors = True )
17
18
18
19
config = ServerCommandConfig (
20
+ environment = environment ,
19
21
input_path = PATH_TO_THIS_TEST_FOLDER ,
20
22
output_path = PATH_TO_OUTPUT_FOLDER ,
21
23
reload = False ,
You can’t perform that action at this time.
0 commit comments