* xspec: define str(xspec) to give back the original specification string

* fix a test invocation

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-05-21 14:33:15 +02:00
parent ec34e9423e
commit 1b48cbb3c6
3 changed files with 7 additions and 4 deletions

View File

@ -36,9 +36,10 @@ class TestXSpec:
for x in ("popen", "popen//python=this"): for x in ("popen", "popen//python=this"):
assert XSpec(x)._spec == x assert XSpec(x)._spec == x
def test_repr(self): def test_repr_and_string(self):
for x in ("popen", "popen//python=this"): for x in ("popen", "popen//python=this"):
assert repr(XSpec(x)).find("popen") != -1 assert repr(XSpec(x)).find("popen") != -1
assert str(XSpec(x)) == x
def test_hash_equality(self): def test_hash_equality(self):
assert XSpec("popen") == XSpec("popen") assert XSpec("popen") == XSpec("popen")

View File

@ -27,6 +27,8 @@ class XSpec:
def __repr__(self): def __repr__(self):
return "<XSpec %r>" %(self._spec,) return "<XSpec %r>" %(self._spec,)
def __str__(self):
return self._spec
def __hash__(self): def __hash__(self):
return hash(self._spec) return hash(self._spec)

View File

@ -121,7 +121,7 @@ class TestNodeManager:
pass pass
""") """)
reprec = testdir.inline_run("-d", "--rsyncdir=%s" % testdir.tmpdir, reprec = testdir.inline_run("-d", "--rsyncdir=%s" % testdir.tmpdir,
"--tx %s" % specssh, testdir.tmpdir) "--tx", specssh, testdir.tmpdir)
ev = reprec.getfirstnamed("pytest_itemtestreport") rep, = reprec.getreports("pytest_itemtestreport")
assert ev.passed assert rep.passed