From 884614e79eb99d216eb998a4ca9f504e07667a5f Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 8 Mar 2012 23:29:28 +0100 Subject: Don't leak tempfiles (and setup.py test should actually do something). --- NEWS.txt | 5 ++++- setup.py | 18 ++++++------------ test/__init__.py | 2 +- yamlish.py | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 9607e2e..d41aca0 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -4,4 +4,7 @@ 0.2 2012-03-08 * Just a packaging issue, don't play with strings too much in setup.py version=yamlish.__version__ and that's it. No fancy formatting. - \ No newline at end of file + +0.3 2012-03-08 + * Excuse me, son, but your tempfiles are leaking !!! + * Also fixing python setup.py test so that it actually does something. \ No newline at end of file diff --git a/setup.py b/setup.py index 9dad10d..f4b2acb 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,7 @@ # coding: utf-8 from __future__ import absolute_import, print_function, unicode_literals from distutils.core import setup, Command -try: - import unittest2 as unittest -except ImportError: - import unittest +import unittest2 as unittest import os.path import yamlish @@ -22,16 +19,13 @@ class RunTests(Command): pass def run(self): - loader = unittest.TestLoader() - loader.discover('.') - suite = loader.suiteClass() - result = unittest.TestResult() - suite.run(result) + tests = unittest.TestLoader().discover('.') + runner = unittest.TextTestRunner() + runner.run(tests) def read(fname): with open(os.path.join(os.path.dirname(__file__), fname)) as inf: return "\n" + inf.read().replace("\r\n", "\n") - # private def get_long_description(): return read("README.txt") \ @@ -40,9 +34,9 @@ def get_long_description(): setup( name='yamlish', - version=yamlish.__version__, + version=str(yamlish.__version__), description='Python implementation of YAMLish', - author='Matej Cepl', + author='Matěj Cepl', author_email='mcepl@redhat.com', url='https://gitorious.org/yamlish', py_modules=['yamlish'], diff --git a/test/__init__.py b/test/__init__.py index cf6dcde..83cdd6d 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -63,7 +63,7 @@ def _create_output_test(test_src, tested_function): logging.debug("out:\n%s", textwrap.dedent(test_src['out'])) want = yaml.load(textwrap.dedent(test_src['out'])) logging.debug("want:\n%s", want) - with tempfile.NamedTemporaryFile(delete=False) as test_file: + with tempfile.NamedTemporaryFile() as test_file: tested_function(test_src['in'], test_file) test_file.seek(0) got_str = test_file.read() diff --git a/yamlish.py b/yamlish.py index e3a9061..fd95d85 100644 --- a/yamlish.py +++ b/yamlish.py @@ -113,7 +113,7 @@ Read more about TAP and YAMLish here: L import logging import yaml -__version__ = "0.2" +__version__ = "0.3" __author__ = "Matěj Cepl " class _YamlishLoader(yaml.loader.SafeLoader): -- cgit