cubicweb/devtools/test/unittest_devctl.py
changeset 11455 d686c4e8cdb2
parent 11454 7770559e3945
child 11456 077f32a7a4c3
--- a/cubicweb/devtools/test/unittest_devctl.py	Thu May 19 14:27:28 2016 +0200
+++ b/cubicweb/devtools/test/unittest_devctl.py	Thu May 19 14:57:41 2016 +0200
@@ -78,6 +78,22 @@
         self.assertEqual(retcode, 0,
                          msg=to_unicode(proc.stdout.read()))
 
+    def test_newcube_sdist(self):
+        """Ensure sdist can be built from a new cube"""
+        tmpdir = tempfile.mkdtemp(prefix="temp-cwctl-newcube-sdist")
+        try:
+            newcube(tmpdir, 'foo')
+            projectdir = osp.join(tmpdir, 'cubicweb-foo')
+            cmd = [sys.executable, 'setup.py', 'sdist']
+            proc = Popen(cmd, stdout=PIPE, stderr=STDOUT, cwd=projectdir)
+            retcode = proc.wait()
+            stdout = to_unicode(proc.stdout.read())
+            self.assertEqual(retcode, 0, stdout)
+            distfpath = osp.join(projectdir, 'dist', 'cubicweb-foo-0.1.0.tar.gz')
+            self.assertTrue(osp.isfile(distfpath))
+        finally:
+            shutil.rmtree(tmpdir, ignore_errors=True)
+
 
 if __name__ == '__main__':
     from unittest import main