From 14370403ebebaaf389f9d57c6e9244de6012f713 Mon Sep 17 00:00:00 2001 From: Ryan Pepper Date: Thu, 9 May 2019 21:58:21 +0100 Subject: [PATCH] Fix various tiny bugs which caused warnings in Pytest --- fidimag/common/chain_method_base.py | 4 +++- fidimag/common/chain_method_integrators.py | 2 +- fidimag/common/nebm_spherical.py | 2 +- setup.py | 8 +++++++- tests/test_skyrmion_number.py | 2 +- tests/test_stt.py | 2 +- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/fidimag/common/chain_method_base.py b/fidimag/common/chain_method_base.py index 2463f935..b5af98e7 100644 --- a/fidimag/common/chain_method_base.py +++ b/fidimag/common/chain_method_base.py @@ -436,7 +436,9 @@ def initialise_integrator(self, self.n_dofs_image, mass=1, stepsize=1e-4) - self.integrator.set_options() + # Note: disabled as at the moment, set_options does not + # do anything for the Verlet integrator! + # self.integrator.set_options() # In Verlet algorithm we only use the total force G and not YxYxG: self._llg_evolve = False else: diff --git a/fidimag/common/chain_method_integrators.py b/fidimag/common/chain_method_integrators.py index 01c379bd..93010f3f 100644 --- a/fidimag/common/chain_method_integrators.py +++ b/fidimag/common/chain_method_integrators.py @@ -86,7 +86,7 @@ def run_until(self, t): return 0 def set_options(self, rtol=1e-8, atol=1e-8): - warnings.warn("Tolerances not available for VerletIntegrator") + raise NotImplementedError("Tolerances not available for VerletIntegrator") def _step(self, t, y, h, f): """ diff --git a/fidimag/common/nebm_spherical.py b/fidimag/common/nebm_spherical.py index 9fd7e300..f20e0ef3 100644 --- a/fidimag/common/nebm_spherical.py +++ b/fidimag/common/nebm_spherical.py @@ -13,7 +13,7 @@ class NEBM_Spherical(ChainMethodBase): - """ + r""" ARGUMENTS ----------------------------------------------------------------- diff --git a/setup.py b/setup.py index caf5663c..6d8d3af7 100644 --- a/setup.py +++ b/setup.py @@ -260,5 +260,11 @@ def glob_files(path, excludes, extension="*.cpp"): 'fidimag.extensions', 'fidimag.common', ], - ext_modules=cythonize(ext_modules, nthreads=nthreads, compiler_directives={'linetrace': True}), + ext_modules=cythonize(ext_modules, + nthreads=nthreads, + compiler_directives={ + 'linetrace': True, + 'language_level': '3', + } + ), ) diff --git a/tests/test_skyrmion_number.py b/tests/test_skyrmion_number.py index 1e9aebc1..611bbb14 100644 --- a/tests/test_skyrmion_number.py +++ b/tests/test_skyrmion_number.py @@ -49,7 +49,7 @@ def init_m_multiple_sks(pos, r, sk_pos): def test_skx_num_atomistic(): - """ + r""" Test the *finite spin chirality* or skyrmion number for a discrete spins simulation in a two dimensional lattice diff --git a/tests/test_stt.py b/tests/test_stt.py index ffa9f593..c3637156 100644 --- a/tests/test_stt.py +++ b/tests/test_stt.py @@ -3,7 +3,7 @@ def test_sst_field_1d(): - """ + r""" This is a direct test of the STT C library We create a 1-D 4 spins system along the x direction with the following components: