Skip to content

Commit a2abd10

Browse files
authored
Merge pull request #32 from hippolyteblot/changing_import_system
Changing import system
2 parents 0861416 + e80cb08 commit a2abd10

File tree

9 files changed

+18
-32
lines changed

9 files changed

+18
-32
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ examples/old
88
publish.sh
99
dist/
1010
.env
11-
test_pipedef.py
11+
atest_pipedef.py

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ packages = ["src/vip_client"]
3636
[tool.hatch.version]
3737
path = "src/vip_client/__init__.py"
3838

39+
[tool.pytest.ini_options]
40+
pythonpath = [
41+
"src"
42+
]
43+
3944
[project.urls]
4045
Homepage = "https://vip.creatis.insa-lyon.fr"
4146
Source = "https://github.com/virtual-imaging-platform/VIP-python-client"
42-
Tracker = "https://github.com/virtual-imaging-platform/VIP-python-client/issues"
47+
Tracker = "https://github.com/virtual-imaging-platform/VIP-python-client/issues"

src/vip_client/__init__.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,7 @@
88
"""
99

1010
# Informations
11-
__version__ = "0.1.3"
11+
__version__ = "0.1.4"
1212
__license__ = "CECILL-B"
1313

14-
# Import classes and packages to secure the namespace
15-
if __package__ != "vip_client":
16-
import sys
17-
from pathlib import Path
18-
SOURCE_ROOT = str(Path(__file__).parents[1]) # <=> /src/
19-
sys.path.append(SOURCE_ROOT)
20-
# Run utils/__init__.py
21-
import vip_client.utils
22-
# Run classes/__init__.py
23-
import vip_client.classes
24-
# Shortcut to import the VipSession class
25-
from vip_client.classes import VipSession
14+
from vip_client.classes import VipSession

src/vip_client/classes/__init__.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,9 @@
77
- VipLoader (planned): base class.
88
"""
99

10-
# Import classes and modules to secure the namespace
11-
if __package__ != "vip_client.classes":
12-
import sys
13-
from pathlib import Path
14-
SOURCE_ROOT = str(Path(__file__).parents[2]) # src/
15-
sys.path.append(SOURCE_ROOT)
16-
# Import utilities
17-
import vip_client.utils
1810
# Replace each class module by its class in the namespace
1911
from vip_client.classes.VipSession import VipSession
2012
from vip_client.classes.VipLauncher import VipLauncher
2113
from vip_client.classes.VipCI import VipCI
2214
from vip_client.classes.VipLoader import VipLoader
23-
from vip_client.classes.VipClient import VipClient
15+
from vip_client.classes.VipClient import VipClient

tests/test_VipCI.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from pathlib import *
55

66
import pytest_mock
7-
from src.vip_client.utils import vip
8-
from src.vip_client.classes import VipCI
7+
from vip_client.utils import vip
8+
from vip_client.classes import VipCI
99
from mocked_services import mock_vip_api, mock_girder_client, mock_pathlib, mock_os
1010
from FakeGirderClient import FakeGirderClient
1111

tests/test_VipLauncher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import pytest
33
from pathlib import *
44

5-
from src.vip_client.utils import vip
6-
from src.vip_client.classes import VipLauncher
5+
from vip_client.utils import vip
6+
from vip_client.classes import VipLauncher
77
from mocked_services import mock_vip_api, mock_pathlib, mock_os
88

99

tests/test_VipSession.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from pathlib import *
55

66
import pytest_mock
7-
from src.vip_client.utils import vip
8-
from src.vip_client.classes import VipSession
7+
from vip_client.utils import vip
8+
from vip_client.classes import VipSession
99
from mocked_services import mock_vip_api, mock_pathlib, mock_os
1010

1111
def get_properties(obj) -> dict:

tests/test_global.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from src.vip_client.classes import VipSession, VipLauncher, VipCI
1+
from vip_client.classes import VipSession, VipCI, VipLauncher
22
from mocked_services import mock_vip_api, mock_pathlib, mock_os, mock_girder_client
33
import pytest
44

tests/test_vip_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import time
33
import os
44

5-
from src.vip_client.utils.vip import *
5+
from vip_client.utils.vip import *
66

77
BASE_PATH_VIP = '/vip/Home/API/client_tests/'
88
BASE_PATH_LOCAL = 'tests/data/'

0 commit comments

Comments
 (0)