Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AndreiPashkin/d5cf007baf77ec9849a7dbedfb31a9de to your computer and use it in GitHub Desktop.
Save AndreiPashkin/d5cf007baf77ec9849a7dbedfb31a9de to your computer and use it in GitHub Desktop.
From 4caf15883b8a892aca26aa8aaa0d40663f9cca82 Mon Sep 17 00:00:00 2001
From: Andrew Pashkin <andrew.pashkin@gmx.co.uk>
Date: Tue, 12 Apr 2016 11:13:03 +0300
Subject: [PATCH] Add a test for loading classes from modules
---
tests/integration/loader/loader.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tests/integration/loader/loader.py b/tests/integration/loader/loader.py
index 6fe9fc5..7b3e09c 100644
--- a/tests/integration/loader/loader.py
+++ b/tests/integration/loader/loader.py
@@ -42,6 +42,9 @@ def loaded():
@depends('non_existantmodulename')
def not_loaded():
return True
+
+class Loaded(object):
+ pass
'''
@@ -85,6 +88,16 @@ class LazyLoaderTest(TestCase):
# Make sure depends correctly kept a function from loading
self.assertTrue(self.module_name + '.not_loaded' not in self.loader)
+ def test_classes_are_loaded(self):
+ '''
+ Classes from modules are loaded.
+ '''
+ self.assertTrue(
+ inspect.isclass(
+ self.loader[self.module_name + '.Loaded']
+ )
+ )
+
class LazyLoaderVirtualEnabledTest(TestCase):
'''
--
2.8.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment