Index: pyyaml/trunk/setup.py
===================================================================
--- pyyaml/trunk/setup.py	(revision 314)
+++ pyyaml/trunk/setup.py	(revision 322)
@@ -270,4 +270,23 @@
 
 
+class test(Command):
+
+    user_options = []
+
+    def initialize_options(self):
+        pass
+
+    def finalize_options(self):
+        pass
+
+    def run(self):
+        build_cmd = self.get_finalized_command('build')
+        build_cmd.run()
+        sys.path.insert(0, build_cmd.build_lib)
+        sys.path.insert(0, 'tests')
+        import test_all
+        test_all.main([])
+
+
 if __name__ == '__main__':
 
@@ -297,4 +316,5 @@
             'build_ext': build_ext,
             'bdist_rpm': bdist_rpm,
+            'test': test,
         },
     )
