Tarek Ziadé avatar Tarek Ziadé committed cb391db

forgot to add a test file

Comments (0)

Files changed (1)

distutils2/tests/test_config.py

+"""Tests for distutils.config."""
+import sys
+import os
+import copy
+
+from distutils2.tests import support, run_unittest
+from distutils2.tests.support import unittest
+
+
+SETUP_CFG = """
+[metadata]
+version = 1.0
+author = tarek
+author_email = tarek@ziade.org
+"""
+
+class ConfigTestCase(support.TempdirManager,
+                     unittest.TestCase):
+
+    def test_config(self):
+        tempdir = self.mkdtemp()
+        setup_cfg = os.path.join(tempdir, 'setup.cfg')
+        f = open(setup_cfg, 'w')
+        try:
+            f.write(SETUP_CFG)
+        finally:
+            f.close()
+
+        # trying to load the metadata now
+        old_args = copy.copy(sys.argv)
+        sys.argv[:] = ['setup.py', '--version']
+        old_wd = os.getcwd()
+        os.chdir(tempdir)
+        try:
+            from distutils2.core import setup
+            dist = setup()
+        finally:
+            os.chdir(old_wd)
+            sys.argv[:] = old_args
+
+        # check what was done
+        self.assertEqual(dist.metadata['Author'], 'tarek')
+        self.assertEqual(dist.metadata['Author-Email'], 'tarek@ziade.org')
+        self.assertEqual(dist.metadata['Version'], '1.0')
+
+
+def test_suite():
+    return unittest.makeSuite(ConfigTestCase)
+
+if __name__ == '__main__':
+    run_unittest(test_suite())
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.