Commit 884614e7 authored by Matěj Cepl's avatar Matěj Cepl

Don't leak tempfiles (and test should actually do something).

parent bf17bdce
......@@ -4,4 +4,7 @@
0.2 2012-03-08
* Just a packaging issue, don't play with strings too much in
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 test so that it actually does something.
\ No newline at end of file
# coding: utf-8
from __future__ import absolute_import, print_function, unicode_literals
from distutils.core import setup, Command
import unittest2 as unittest
except ImportError:
import unittest
import unittest2 as unittest
import os.path
import yamlish
......@@ -22,16 +19,13 @@ class RunTests(Command):
def run(self):
loader = unittest.TestLoader()'.')
suite = loader.suiteClass()
result = unittest.TestResult()
tests = unittest.TestLoader().discover('.')
runner = unittest.TextTestRunner()
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as inf:
return "\n" +"\r\n", "\n")
# private
def get_long_description():
return read("README.txt") \
......@@ -40,9 +34,9 @@ def get_long_description():
description='Python implementation of YAMLish',
author='Matej Cepl',
author='Matěj Cepl',
......@@ -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)
got_str =
......@@ -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 <mcepl_at_redhat_dot_com>"
class _YamlishLoader(yaml.loader.SafeLoader):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment