Skip to content

Commit 74d2b40

Browse files
committed
[PortsPy] More place in which proper Symbols should be used (temporary ci failure until ruby-smtp branch is merged)
1 parent 446d857 commit 74d2b40

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

ports-py/ports.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ def create_placeholder(self, name, parameters, doc_string=""):
124124

125125
def initialize_ports_primitives(self):
126126
self.lispy_env.update({
127-
"create-placeholder": lambda *args: self.create_placeholder(*args),
128-
"is-placeholder?": lambda x: isinstance(x, Placeholder),
129-
"assert": ports_assert,
130-
"assert-equal": ports_assert_eq,
131-
"is-assertion-error?": lambda e: isinstance(e, AssertionError),
132-
"thread": ports_thread,
133-
"thread-wait-for-completion": ports_thread_join,
134-
"thread-sleep!": lambda x: time.sleep(float(x)),
135-
"thread-yield": ports_thread_yield,
127+
lispy.Sym("create-placeholder"): lambda *args: self.create_placeholder(*args),
128+
lispy.Sym("is-placeholder?"): lambda x: isinstance(x, Placeholder),
129+
lispy.Sym("assert"): ports_assert,
130+
lispy.Sym("assert-equal"): ports_assert_eq,
131+
lispy.Sym("is-assertion-error?"): lambda e: isinstance(e, AssertionError),
132+
lispy.Sym("thread"): ports_thread,
133+
lispy.Sym("thread-wait-for-completion"): ports_thread_join,
134+
lispy.Sym("thread-sleep!"): lambda x: time.sleep(float(x)),
135+
lispy.Sym("thread-yield"): ports_thread_yield,
136136
})
137137

138138
def initialize_ports(self):
@@ -141,7 +141,7 @@ def initialize_ports(self):
141141

142142
def placeholder(self, name):
143143
def decorator(func):
144-
self.placeholder_functions[name] = func
144+
self.placeholder_functions[lispy.Sym(name)] = func
145145
return func
146146
return decorator
147147

@@ -177,14 +177,15 @@ def generate_unittest_test_method(self, ports_test):
177177
return lambda testcase: self.run_test(ports_test)
178178

179179
def run_test(self, ports_test):
180+
print(self.eval_with_args("(test-name current_test)", current_test=ports_test))
180181
return self.eval_with_args("(test-run current_test)", current_test=ports_test)
181182

182-
def run(self, only=None, only_capabilities=None, exclude=None, exclude_capabilities=None, expected_failures=[]):
183+
def run_unittest(self, only=None, only_capabilities=None, exclude=None, exclude_capabilities=None, expected_failures=[]):
183184
self.initialize_suite()
184185
self.install_setUp_tearDown_functions()
185186
self.ensure_placeholders_are_valid()
186187
self.lispy_env.update({
187-
"root-capability": self.root_capability,
188+
lispy.Sym("root-capability"): self.root_capability,
188189
})
189190
tests = self.eval("(capability-all-tests root-capability)")
190191

@@ -205,6 +206,20 @@ def run(self, only=None, only_capabilities=None, exclude=None, exclude_capabilit
205206
test_suite.addTest(test_case)
206207
unittest.TextTestRunner().run(test_suite)
207208

209+
def run(self, only=None, only_capabilities=None, exclude=None, exclude_capabilities=None, expected_failures=[]):
210+
self.initialize_suite()
211+
self.install_setUp_tearDown_functions()
212+
self.ensure_placeholders_are_valid()
213+
self.lispy_env.update({
214+
lispy.Sym("root-capability"): self.root_capability,
215+
})
216+
self.eval_with_args(
217+
"(run-suite suite_name suite_version root-capability only_tests only_capabilities exclude exclude_capabilities expected_failures)",
218+
suite_name=self.suite_name,
219+
suite_version=self.suite_version,
220+
only_tests=only, only_capabilities=only_capabilities, exclude=exclude, exclude_capabilities=exclude_capabilities,
221+
expected_failures=expected_failures)
222+
208223

209224
def suite(file_name):
210225
return PortsSuite(file_name)

0 commit comments

Comments
 (0)