This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

features

  • shortcuts
  • parameterized
  • nested

shortcuts

this is tiresome.

import unittest

class Tests(unittest.TestCase):
    def _getTarget(self):
        from foo.bar import boo
        return boo

    def _callFUT(self, *args, **kwargs):
        self._getTarget()(*args, **kwargs)

    def test_it(self):
        params = object()
        result = self._callFUT(params)
        self.assertEqual(result, params)

shortcuts decorator

  • test_target – adding _getTarget(), _makeOne() methods
  • test_function – adding _getTarget(), _callFUT() methods
import unittest
from evilunit import test_function

@test_function("foo.bar:boo")
class Tests(unittest.TestCase):
    def test_it(self):
        params = object()
        result = self._callFUT(params)
        self.assertEqual(result, params)

parameterized

import unittest
from evilunit import NestedTest, nested_test_compile

class Tests(unittest.TestCase):
    def _callFUT(self, x, y):
        return x + y

    @paramaterized([
        (1, 2, 3),
        (1, 1, 2),
        (1, 0, 1),
        (2, 3, 5),
        (4, 4, 8)
    ])
    def _test_add(self, x, y, expected):
        """adding number"""
        result = self._callFUT(x, y)
        self.assertEqual(result, expected)

    @classmethod
    def tearDownClass(cls):
        count_of_test_method = sum(1 for k, v in cls.__dict__.items() if k.startswith("test_") and callable(v))
        assert count_of_test_method == 5

nested

import unittest
from evilunit import NestedTest, nested_test_compile


L = []


@nested_test_compile
class ToplevelTest(NestedTest):
    @classmethod
    def setUpClass(cls):
        assert issubclass(cls, unittest.TestCase)
        L.append("t1")

    def setUp(self):
        assert isinstance(self, unittest.TestCase)
        L.append("t2")

    def test_it(self):
        assert isinstance(self, unittest.TestCase)
        L.append("t3")
        self.assertEqual(L, ["t1", "t2", "t3"])

    def tearDown(self):
        assert isinstance(self, unittest.TestCase)
        global L
        L = []

    class Child(NestedTest):
        @classmethod
        def setUpClass(cls):
            assert issubclass(cls, unittest.TestCase)
            L.append("m1")

        def setUp(self):
            assert isinstance(self, unittest.TestCase)
            L.append("m2")

        def test_it(self):
            assert isinstance(self, unittest.TestCase)
            L.append("m3")
            self.assertEqual(L, ["t1", "m1", "t2", "m2", "m3"])

        class GrandChild(NestedTest):
            @classmethod
            def setUpClass(cls):
                assert issubclass(cls, unittest.TestCase)
                L.append("n1")

            def setUp(self):
                assert isinstance(self, unittest.TestCase)
                L.append("n2")

            def test_it(self):
                assert isinstance(self, unittest.TestCase)
                L.append("n3")
                self.assertEqual(L, ["t1", "m1", "n1", "t2", "m2", "n2", "n3"])

    class Child2(NestedTest):
        @classmethod
        def setUpClass(cls):
            assert issubclass(cls, unittest.TestCase)
            L.append("o1")

        def setUp(self):
            assert isinstance(self, unittest.TestCase)
            L.append("o2")

        def test_it(self):
            assert isinstance(self, unittest.TestCase)
            L.append("o3")
            self.assertEqual(L, ["t1", "o1", "t2", "o2", "o3"])

0.1.1: - fix if fixture is undefined in child class parent class’s method is not called.

Release History

Release History

0.1.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
evilunit-0.1.3.tar.gz (5.3 kB) Copy SHA256 Checksum SHA256 Source Mar 8, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting