From 3ad2f168e5829b72540b9174b1433fb090937574 Mon Sep 17 00:00:00 2001
From: Anton Akhmerov <anton.akhmerov@gmail.com>
Date: Fri, 10 Jun 2016 03:18:14 +0200
Subject: [PATCH] use flakes in ci, fix flakes warnings

---
 .gitlab-ci.yml                     | 2 +-
 kwant/digest.py                    | 1 -
 kwant/solvers/default.py           | 2 +-
 kwant/solvers/sparse.py            | 1 -
 kwant/solvers/tests/test_sparse.py | 1 -
 kwant/system.py                    | 1 -
 kwant/tests/test_plotter.py        | 2 +-
 pytest.ini                         | 4 ++++
 8 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4e38a622..9aed78e9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -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
diff --git a/kwant/digest.py b/kwant/digest.py
index 0b502d5f..cd53095e 100644
--- a/kwant/digest.py
+++ b/kwant/digest.py
@@ -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']
 
diff --git a/kwant/solvers/default.py b/kwant/solvers/default.py
index 10081cf6..e07f19aa 100644
--- a/kwant/solvers/default.py
+++ b/kwant/solvers/default.py
@@ -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
diff --git a/kwant/solvers/sparse.py b/kwant/solvers/sparse.py
index 69f9a3a8..b9b7bb04 100644
--- a/kwant/solvers/sparse.py
+++ b/kwant/solvers/sparse.py
@@ -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
diff --git a/kwant/solvers/tests/test_sparse.py b/kwant/solvers/tests/test_sparse.py
index 95a2afe3..1c432e2e 100644
--- a/kwant/solvers/tests/test_sparse.py
+++ b/kwant/solvers/tests/test_sparse.py
@@ -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():
diff --git a/kwant/system.py b/kwant/system.py
index afdfa513..5b856674 100644
--- a/kwant/system.py
+++ b/kwant/system.py
@@ -11,7 +11,6 @@
 __all__ = ['System', 'FiniteSystem', 'InfiniteSystem']
 
 import abc
-import types
 from copy import copy
 from . import _system
 
diff --git a/kwant/tests/test_plotter.py b/kwant/tests/test_plotter.py
index 462cb2b3..b1f6f2b7 100644
--- a/kwant/tests/test_plotter.py
+++ b/kwant/tests/test_plotter.py
@@ -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():
diff --git a/pytest.ini b/pytest.ini
index a77b6256..6c8258da 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,2 +1,6 @@
 [pytest]
 testpaths = kwant
+flakes-ignore =
+    __init__.py UnusedImport
+    graph/tests/test_scotch.py UndefinedName
+    graph/tests/test_dissection.py UndefinedName
-- 
GitLab