From b0266116b24b18c31f12cf2743a541fbaa3de5b2 Mon Sep 17 00:00:00 2001
From: gpotter2 <gabriel@potter.fr>
Date: Tue, 2 May 2017 21:58:57 +0200
Subject: [PATCH] Add pipetool tests

---
 scapy/pipetool.py | 23 -----------------------
 test/pipetool.uts | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 23 deletions(-)
 create mode 100644 test/pipetool.uts

diff --git a/scapy/pipetool.py b/scapy/pipetool.py
index e9a6fb80..756f3e74 100644
--- a/scapy/pipetool.py
+++ b/scapy/pipetool.py
@@ -609,26 +609,3 @@ class DownDrain(Drain):
         pass
     def high_push(self, msg):
         self._send(msg)
-        
-
-def _testmain():
-    s = PeriodicSource("hello", 1, name="src")
-    d1 = Drain(name="d1")
-    c = ConsoleSink(name="c")
-    tf = TransformDrain(lambda x:"Got %r" % x)
-    t = TermSink(name="t", keepterm=False)
-
-    s > d1 > c
-    d1 > tf > t
-
-    p = PipeEngine(s)
-
-    p.graph(type="png",target="> /tmp/pipe.png")
-
-    p.start()
-    time.sleep(5)
-    p.stop()
-
-
-if __name__ == "__main__":
-    _testmain()
diff --git a/test/pipetool.uts b/test/pipetool.uts
new file mode 100644
index 00000000..f063e8ff
--- /dev/null
+++ b/test/pipetool.uts
@@ -0,0 +1,21 @@
+########################
+% Pipetool related tests
+########################
+
++ Basic tests
+
+= Test default test case
+
+s = PeriodicSource("hello", 1, name="src")
+d1 = Drain(name="d1")
+c = ConsoleSink(name="c")
+tf = TransformDrain(lambda x:"Got %r" % x)
+t = TermSink(name="t", keepterm=False)
+s > d1 > c
+d1 > tf > t
+
+p = PipeEngine(s)
+p.graph(type="png",target="> /tmp/pipe.png")
+p.start()
+time.sleep(3)
+p.stop()
-- 
GitLab