Skip to content
Permalink
Browse files

Give stub test classes unique names

They still had references from the master file they were originally
copied from, causing problems when running the full test suite.

Also adds linting fixes to the base test class.
  • Loading branch information
lovett committed Sep 2, 2019
1 parent 93d5369 commit 11058011ecebb9cc0e4b3aade7461794ae1ce542
@@ -7,13 +7,13 @@
import plugins.applog


class TestUrl(unittest.TestCase):
class TestApplog(unittest.TestCase):
"""
Tests for the applog plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.applog.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.audio


class TestUrl(unittest.TestCase):
class TestAudio(unittest.TestCase):
"""
Tests for the audio plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.audio.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.bookmarks


class TestUrl(unittest.TestCase):
class TestBookmarks(unittest.TestCase):
"""
Tests for the bookmarks plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.bookmarks.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.cache


class TestUrl(unittest.TestCase):
class TestCache(unittest.TestCase):
"""
Tests for the cache plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.cache.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.capture


class TestUrl(unittest.TestCase):
class TestCapture(unittest.TestCase):
"""
Tests for the capture plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.capture.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.cdr


class TestUrl(unittest.TestCase):
class TestCdr(unittest.TestCase):
"""
Tests for the cdr plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.cdr.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.checksum


class TestUrl(unittest.TestCase):
class TestChecksum(unittest.TestCase):
"""
Tests for the checksum plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.checksum.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -3,17 +3,15 @@
"""

import unittest
import cherrypy
import plugins.converters


class TestUrl(unittest.TestCase):
class TestConverters(unittest.TestCase):
"""
Tests for the converters plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
pass

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -3,17 +3,15 @@
"""

import unittest
import cherrypy
import plugins.decorators


class TestUrl(unittest.TestCase):
class TestDecorators(unittest.TestCase):
"""
Tests for the decorators plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
pass

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.formatting


class TestUrl(unittest.TestCase):
class TestFormatting(unittest.TestCase):
"""
Tests for the formatting plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.formatting.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.geography


class TestUrl(unittest.TestCase):
class TestGeography(unittest.TestCase):
"""
Tests for the geography plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.geography.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.hasher


class TestUrl(unittest.TestCase):
class TestHasher(unittest.TestCase):
"""
Tests for the hasher plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.hasher.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.ip


class TestUrl(unittest.TestCase):
class TestIp(unittest.TestCase):
"""
Tests for the ip plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.ip.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.jinja


class TestUrl(unittest.TestCase):
class TestJinja(unittest.TestCase):
"""
Tests for the jinja plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.jinja.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.logindex


class TestUrl(unittest.TestCase):
class TestLogindex(unittest.TestCase):
"""
Tests for the logindex plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.logindex.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.mail


class TestUrl(unittest.TestCase):
class TestMail(unittest.TestCase):
"""
Tests for the mail plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.mail.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.maintenance


class TestUrl(unittest.TestCase):
class TestMaintenance(unittest.TestCase):
"""
Tests for the maintenance plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.maintenance.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.memorize


class TestUrl(unittest.TestCase):
class TestMemorize(unittest.TestCase):
"""
Tests for the memorize plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.memorize.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -20,7 +20,7 @@ def _path(name):
"""

return os.path.join(
cherrypy.config.get("database_dir"),
cherrypy.config.get("database_dir", "db"),
name
)

@@ -147,7 +147,7 @@ def _explain(self, query, values=()):
"""Get the query plan for a query."""

return self._select(
"EXPLAIN QUERY PLAN {}".format(query),
f"EXPLAIN QUERY PLAN {query}",
values
)

@@ -159,7 +159,7 @@ def _cacheTable(query):
"""

checksum = cherrypy.engine.publish("checksum:string", query).pop()
return "cache_{}".format(checksum)
return f"cache_{checksum}"

def _tableNames(self):
"""Get a list of tables in the database."""
@@ -172,7 +172,7 @@ def _tableNames(self):
def _dropCacheTables(self):
"""Remove all existing cache tables"""
delete_queries = [
("DROP TABLE {}".format(table), ())
(f"DROP TABLE {table}", ())
for table in self._tableNames()
if table.startswith("cache_")
]
@@ -192,10 +192,10 @@ def _selectToCache(self, query, values):

# This delete is redundant with _dropCacheTables(), but it allows
# a single cache to be cleaned up, instead of all of them.
cur.execute("DROP TABLE IF EXISTS {}".format(cache_table))
cur.execute(f"DROP TABLE IF EXISTS {cache_table}")

cur.execute(
"CREATE TABLE {} AS {}".format(cache_table, query),
"CREATE TABLE {cache_table} AS {query}",
values
)

@@ -3,17 +3,15 @@
"""

import unittest
import cherrypy
import plugins.mixins


class TestUrl(unittest.TestCase):
class TestMixins(unittest.TestCase):
"""
Tests for the mixins plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
pass

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.notifier


class TestUrl(unittest.TestCase):
class TestNotifier(unittest.TestCase):
"""
Tests for the notifier plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.notifier.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""
@@ -7,13 +7,13 @@
import plugins.parse


class TestUrl(unittest.TestCase):
class TestParse(unittest.TestCase):
"""
Tests for the parse plugin
"""

def setUp(self):
self.plugin = plugins.url.Plugin(cherrypy.engine)
self.plugin = plugins.parse.Plugin(cherrypy.engine)

def test_placeholder(self):
"""Placeholder to force pytest to generate a coverage file."""

0 comments on commit 1105801

Please sign in to comment.
You can’t perform that action at this time.