Skip to content

Commit efb3f92

Browse files
committed
Merge pull request #57 from T045T/fix-travis
Fix travis builds
2 parents 9acfea3 + 774d91b commit efb3f92

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pylint_django/transforms/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ def set_fake_locals(module):
2626
if module.name != package_name:
2727
return
2828
for class_name in class_names:
29-
module._locals[class_name] = fake._locals[class_name] # pylint: disable=protected-access
29+
# This changed from locals to _locals between astroid 1.3 and 1.4
30+
if hasattr(module, '_locals'):
31+
module._locals[class_name] = fake._locals[class_name] # pylint: disable=protected-access
32+
else:
33+
module.locals[class_name] = fake.locals[class_name]
3034

3135
MANAGER.register_transform(nodes.Module, set_fake_locals)
3236

test/test_func.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
import os
3+
import sys
34
import unittest
45
from django.conf import settings
56
from pylint.testutils import make_tests, LintTestUsingFile, cb_test_gen, linter
@@ -12,6 +13,11 @@
1213

1314

1415
linter.load_plugin_modules(['pylint_django'])
16+
# Disable some things on Python2.6, since we use a different pylint version here
17+
# (1.3 on Python2.6, 1.4+ on later versions)
18+
if sys.version_info < (2, 7):
19+
linter.global_set_option('required-attributes', ())
20+
linter.global_set_option('disable', ('E0012',))
1521

1622

1723
def module_exists(module_name):

0 commit comments

Comments
 (0)