summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2015-01-16 02:58:40 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2015-01-16 03:07:50 +0100
commit4609569ec9a7b9ea083c5546fa38ef401bba5fa8 (patch)
tree6dabbcd682af5ff75f2eac634cef06e79a0be200
parent2685205240144a6b95bba5062e5fcd374a82edfe (diff)
downloadbcfg2-maint.tar.gz
bcfg2-maint.tar.bz2
bcfg2-maint.zip
testsuite: support for python-2.7.9maint
pylint could not parse the dynamic assignment of the PROTOCOL_* values in the ssl module (the real values are in the _ssl extension). We dynamically add here the PROTOCOL_* constants we need.
-rw-r--r--testsuite/ext/ssl_protocols.py17
-rw-r--r--testsuite/pylintrc.conf2
2 files changed, 18 insertions, 1 deletions
diff --git a/testsuite/ext/ssl_protocols.py b/testsuite/ext/ssl_protocols.py
new file mode 100644
index 000000000..66068d2a9
--- /dev/null
+++ b/testsuite/ext/ssl_protocols.py
@@ -0,0 +1,17 @@
+try:
+ from logilab.astng import MANAGER, scoped_nodes, node_classes
+ PYLINT=0
+except ImportError:
+ from astroid import MANAGER, scoped_nodes, node_classes
+ PYLINT=1
+
+def ssl_transform(module):
+ if module.name == 'ssl':
+ for proto in ('SSLv23', 'TLSv1'):
+ module.locals['PROTOCOL_%s' % proto] = [node_classes.Const()]
+
+def register(linter):
+ if PYLINT == 0:
+ MANAGER.register_transformer(ssl_transform)
+ else:
+ MANAGER.register_transform(scoped_nodes.Module, ssl_transform)
diff --git a/testsuite/pylintrc.conf b/testsuite/pylintrc.conf
index 94904877b..b3340cb4f 100644
--- a/testsuite/pylintrc.conf
+++ b/testsuite/pylintrc.conf
@@ -19,7 +19,7 @@ persistent=no
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
-load-plugins=ext.exception_messages
+load-plugins=ext.exception_messages,ext.ssl_protocols
[MESSAGES CONTROL]