Skip to content
Snippets Groups Projects
Commit 533d7938 authored by Anton Akhmerov's avatar Anton Akhmerov
Browse files

Merge branch 'flakes' into 'master'

Flakes for CI

* I've switched on flakes in CI so that it can catch some simple errors.
* Among cruft pyflakes has identified two actual bugs.

Right now pyflakes is too simple-minded to digest dynamic formation of `__all__` in `__init__.py`, should we do something about it or should we rather silence pyflakes like I did?

See merge request !29
parents f5ee5d1b 3ad2f168
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -3,4 +3,4 @@ job:
- python3 setup.py build
- python3 setup.py build_ext -i
- make -C doc clean && make -C doc html
- py.test --cov=kwant kwant
\ No newline at end of file
- py.test --cov=kwant --flakes kwant
......@@ -22,7 +22,6 @@ this module.
from math import pi, log, sqrt, cos
from hashlib import md5
from struct import unpack
import sys
__all__ = ['uniform', 'gauss', 'test']
......
......@@ -14,6 +14,7 @@ __all__ = ['MUMPSContext', 'schur_complement', 'AnalysisStatistics',
import time
import numpy as np
import scipy.sparse
import warnings
from . import _mumps
from .fortran_helpers import prepare_for_fortran
......
......@@ -81,3 +81,10 @@ def test_error_minus_9(r=10):
# No need to check result, it's enough if no exception is raised
MUMPSContext().factor(ham)
def test_factor_warning():
"""Test that a warning is raised if factor is asked without analysis."""
a = sp.identity(10, dtype=complex)
with pytest.warns(RuntimeWarning):
MUMPSContext().factor(a, reuse_analysis=True)
......@@ -6,7 +6,7 @@
# the file AUTHORS.rst at the top-level directory of this distribution and at
# http://kwant-project.org/authors.
__all__ = ['smatrx', 'ldos', 'wave_function', 'greens_function']
__all__ = ['smatrix', 'ldos', 'wave_function', 'greens_function']
# MUMPS usually works best. Use SciPy as fallback.
import warnings
......
......@@ -8,7 +8,6 @@
__all__ = ['smatrix', 'greens_function', 'ldos', 'wave_function', 'Solver']
import warnings
import numpy as np
import scipy.sparse as sp
from . import common
......
......@@ -7,7 +7,6 @@
# http://kwant-project.org/authors.
from kwant.solvers.sparse import smatrix, greens_function, ldos, wave_function
import kwant.solvers.sparse
from . import _test_sparse
def test_output():
......
......@@ -11,7 +11,6 @@
__all__ = ['System', 'FiniteSystem', 'InfiniteSystem']
import abc
import types
from copy import copy
from . import _system
......
......@@ -15,7 +15,7 @@ import pytest
if plotter.mpl_enabled:
from mpl_toolkits import mplot3d
from matplotlib import pyplot
from matplotlib import pyplot # pragma: no flakes
def test_importable_without_matplotlib():
......
[pytest]
testpaths = kwant
flakes-ignore =
__init__.py UnusedImport
graph/tests/test_scotch.py UndefinedName
graph/tests/test_dissection.py UndefinedName
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment