Commit Graph
31 Commits
Author SHA1 Message Date
Adrian Torres e5c864a596 [REM] test_pylint: remove PY2/PY3 restrictions
Since Odoo no longer officially supports python 2, some of the
restrictions previously imposed by test_pylint are no longer necessary,
either because the usage of some builtin functions is legal (zip, map,
filter) or because the concerned function/module would already raise a
relevant error under python 3.
2018-11-29 09:24:26 +00:00
Christophe Simonis 73652a0b19 [MERGE] forward port branch saas-11.3 up to 50860317cc
Note: 1aacc96262 has been ignored and will
be forward-ported later
2018-06-15 13:27:27 +02:00
Andreas Perhab e34a9ba58f [FIX] test_pylint: incompatibility between pylint 1.6 and python 3.6
reference: https://github.com/PyCQA/pylint/issues/1349

pylint 1.6 and python 3.5 (and below) should work fine, so no need to
force people to upgrade there.
2018-06-12 10:12:09 +02:00
Raphael Collet 6a601fe6dc [IMP] test-pylint: check for undefined variables 2018-05-16 13:58:39 +02:00
Christophe Simonis 5ad55264e4 [MERGE] forward port branch saas-15 up to b04c8eae6b 2018-03-01 18:02:30 +01:00
Christophe Monniez 82e9cc7f97 [IMP] test_pylint: test the presence of python debuggers
From time to time, it happens that a developper forget to remove debuggers.
This commit adds a test to find such imports (pdb and pudb). The test
will fail if that kind of import is found. The Odoo runbot should run
this test and prevent developper from those small mistakes.
2018-02-26 16:12:54 +01:00
Christophe Simonis 10128fa7e8 [MERGE] forward port branch saas-16 up to dc2a6c6cd2 2017-10-20 19:27:04 +02:00
Christophe Simonis 5ea0f55d65 [MERGE] forward port branch saas-15 up to bee0c11ef7 2017-10-20 17:57:21 +02:00
Christophe Simonis 9b4447e9aa [IMP] test_pylint: check for mixed-indentation 2017-10-19 22:33:37 +02:00
Christophe Simonis 017ee5eab3 [MERGE] forward port branch saas-17 up to 877e709871 2017-08-24 13:17:53 +02:00
Xavier Morel 8361ec8819 [FIX] phantomjs for p3
P2 and P3 subprocess stdout seem to have very odd/different behaviours
in the face of mixing select and buffering.

Use raw/low-level IO (os.read) with select to try and fix that
up. Also read more than one byte at a time since os.read will not
block *if* the fd is readable, it will just get whatever data is
immediately available.
2017-08-23 14:34:50 +02:00
Olivier Dony 695716efb0 [FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.

All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.

Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.

Also removed some dead code or improved the API to remove unnecessary
conversions.
2017-08-20 23:25:54 +02:00
Xavier Morel be7c5aefdf [FIX] P3: CSV reading & writing 2017-08-20 23:25:54 +02:00
Xavier Morel 3824b5dcc1 [FIX] P3: fix base64 and StringIO uses
* StringIO removed from stdlib, replace with io
* try to correctly handle BytesIO/StringIO (one is for bytes the other
  is for text)
* fix base64: Python 3 removed bytes-encoding and bytes-bytes
  codecs (via #encode) so replace all calls to str.encode('base64'),
  also b64encode is a bytes->bytes conversion so attempt to properly
  handle that

issue #8530
2017-08-20 23:25:54 +02:00
Christophe Simonis c955c3051c [IMP] test_pylint: do not load default config file
This will avoid useless warning when the file does not exists and
possible false positive errors in case of invalid config in this file.

Also strip output
2017-08-07 15:02:56 +02:00
Christophe Simonis 0ebe59f5d0 [IMP] test_pylint: check for badly written try/except 2017-08-07 15:02:56 +02:00
Christophe Simonis 9882f24313 [IMP] test_pylint: check for python3 incompatibilities 2017-08-07 15:02:56 +02:00
xmo-odoo 05abc1faed [FIX] test_pylint: pylint error output to failure
Sometimes PyLint itself blows up which fails the test but does not
provide any indication as to why, which is inconvenient.
2017-05-19 16:46:42 +02:00
Xavier Morel 4550f45f47 [FIX] P3: document stdlib changes
Also lint away verboten stdlib modules.
2017-05-15 12:26:32 +02:00
Xavier Morel 54df4b36d7 [FIX] P3: types.NoneType removed 2017-05-15 12:26:29 +02:00
Xavier Morel 3833c8997d [FIX] P3: removed commands module 2017-05-15 12:26:16 +02:00
Xavier Morel 3dd3790597 [FIX] P3: raise exception with existing traceback
In Python 2, to raise a new exception but reuse a traceback requires a
special form of ``raise`` (``raise etype, evalue, tb``).

In Python 3, this is now done via a ``with_traceback`` method on
exception objects.

However this requires a bit of trickery as the former is invalid
syntax in Python 3, hence pycompat bridge created via an exec for
Python 2.
2017-05-12 16:15:39 +02:00
Xavier Morel a5a10e75ab [FIX] P3: file builtin removed
* replace with open()
* forbid file() builtin since reports-removal was merged
2017-05-12 09:27:17 +02:00
xmo-odoo bc4391471e [FIX] P3: lint away some already cleaned up stuff
These issues were checked/cleaned previously but the linter was not updated.
2017-05-11 15:27:02 +02:00
xmo-odoo 6659d5a7d2 [FIX] P3: metaclasses handling
* cross-version metaclass spec
* more formally deprecate browse_record and browse_null since they
  were using metaclasses anyway
* update docstrings referencing the latter
2017-05-11 15:25:36 +02:00
xmo-odoo fffaf735f5 [FIX] P3: list -> iterable builtins (#16811)
In Python 3:

* various builtins and dict methods were changed to return
  view/iterable objects rather than lists
* and the separate Python 2 view/iterable builtins and methods were
  removed altogether

This is problematic when using these items as list (which the happens
repeatedly in Odoo), but more viciously when iterating *multiple times*
over them (which also happens, which I've messed up multiple times while
writing this, and which is a pain to debug even when you've just created
the issue).

Convert all code using these to semantics-matching cross-version
helper functions to get the LCD behaviour between P2 and P3, and
forbid the builtins via lint.

issue #8530
2017-05-10 09:39:55 +02:00
xmo-odoo b4429c2a91 [FIX] Various P3-related import changes
* LDAP import: python-ldap is not python3-compatible, pyldap is

  Warning: only supported from debian Stretch (current testing)?
  https://packages.debian.org/search?searchon=names&keywords=pyldap

* implicitly relative imports
* imports of moved or removed stdlib modules

issue #8530
2017-04-28 09:06:53 +02:00
xmo-odoo 2e6a589f41 [FIX] builtins removed from Python 3
* Reverse wrapper courtesy of @rco-odoo's original P3 branch
* thin compat module stripped down from werkzeug (to augment as needed)

issue 8530
2017-04-27 13:59:33 +02:00
Simon Lejeune ecac88dcc0 [ADD] pylint: using variable before assignment 2016-10-19 15:18:58 +02:00
Olivier Dony 859d443863 [IMP] *: rename manifest files for v10 naming convention 2016-09-05 11:57:50 +02:00
Raphael Collet 9e64f9f951 [REF] openerp: move openerp to odoo 2016-09-02 17:28:12 +02:00