Skip to content

Commit 72d0dd6

Browse files
committed
fix test loader
1 parent 8c491f2 commit 72d0dd6

File tree

4 files changed

+10
-45
lines changed

4 files changed

+10
-45
lines changed

docs/installation.rst

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/tutorial.rst

Lines changed: 0 additions & 12 deletions
This file was deleted.

solid_node/core/loader.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from importlib import import_module
55
from solid_node.core.refactor import refactor_requests
66
from solid_node.node.base import AbstractBaseNode
7-
from solid_node.test import TestCase
7+
from solid_node.test import TestCase, TestCaseMixin
88

99
sys.path.append(os.getcwd())
1010

@@ -18,11 +18,13 @@ def load_test(path):
1818
raise Exception(f"Can only load .py files, not {path}")
1919

2020
parts = path.split('/')
21-
parts[-1] = f'test_{parts[-1]}'
22-
path = '/'.join(parts)
23-
24-
if os.path.exists(path):
25-
return load_instance(path, TestCase)
21+
if parts[-1] == '__init__.py':
22+
parts[-1] = 'test.py'
23+
else:
24+
parts[-1] = f'test_{parts[-1]}'
25+
test_path = '/'.join(parts)
26+
if os.path.exists(test_path):
27+
return load_instance(test_path, TestCase)
2628

2729
def load_instance(path, BaseClass):
2830
path = os.path.realpath(path)

solid_node/manager/test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def add_arguments(self, parser):
2626
def handle(self, args):
2727
self.node = self.build_node(args.path)
2828
self.test_case = load_test(args.path)
29-
self.test_case.set_node(self.node)
29+
if self.test_case:
30+
self.test_case.set_node(self.node)
3031
self.failfast = args.failfast
3132
self.run_tests()
3233

0 commit comments

Comments
 (0)