Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Test for decorators that are ignored due to import restrictions #13

Closed
wants to merge 1 commit into from

2 participants

@robinharms

Attached to #12
Test for legit decorators that are ignored by a scan due to the new import directive

@mcdonc mcdonc closed this pull request from a commit
@mcdonc mcdonc - Don't ignore decorated objects within their original locations if they
  happen to be imported into another module (remove ``seen`` set from invoke
  in venusian scanning).  See #13 .

Closes #13.
51cc6d6
@mcdonc mcdonc closed this in 51cc6d6
@mcdonc
Owner

Thanks a lot for this! It'll be in the next release, which I'll try to do today.

@mcdonc
Owner

1.0a6 out with the fix, thanks again.

@robinharms

No problem, I'm the one who should be grateful since I'm using Venusian a lot. So thank you too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 23, 2012
  1. @robinharms

    Test to make sure that decorators are picked up even if they're impor…

    robinharms authored
    …ted when the whole package is scanned
This page is out of date. Refresh to see the latest.
View
1  venusian/tests/fixtures/import_and_scan/__init__.py
@@ -0,0 +1 @@
+# package
View
4 venusian/tests/fixtures/import_and_scan/decorators.py
@@ -0,0 +1,4 @@
+from venusian.tests.fixtures import decorator
+
+decoone = decorator
+decotwo = decorator
View
7 venusian/tests/fixtures/import_and_scan/one.py
@@ -0,0 +1,7 @@
+from .decorators import decoone
+from .two import twofunction # should not be scanned
+
+@decoone(function=True)
+def onefunction(request): # pragma: no cover
+ twofunction(request)
+ return request
View
5 venusian/tests/fixtures/import_and_scan/two.py
@@ -0,0 +1,5 @@
+from .decorators import decotwo
+
+@decotwo(function=True)
+def twofunction(request): # pragma: no cover
+ return request
View
9 venusian/tests/test_venusian.py
@@ -118,6 +118,15 @@ def test_ignore_imported(self):
scanner.scan(two)
self.assertEqual(len(test.registrations), 2)
+ def test_dont_ignore_legit_decorators(self):
+ # make sure venusian picks up other decorated things from
+ # imported modules when the whole package is scanned
+ from venusian.tests.fixtures import import_and_scan
+ test = Test()
+ scanner = self._makeOne(test=test)
+ scanner.scan(import_and_scan)
+ self.assertEqual(len(test.registrations), 2)
+
def test_one_category(self):
from venusian.tests.fixtures import category
test = Test()
Something went wrong with that request. Please try again.