1
1
import pytest
2
2
3
3
4
- def test_finite_extension_from_limit_valuation ():
5
- r"""
6
- Run the ``TestSuite()`` for two examples given in the
7
- ``FiniteExtensionFromLimitValuation`` documentation.
8
- """
9
- from sage .misc .sage_unittest import TestSuite
4
+ @pytest .fixture
5
+ def w ():
10
6
from sage .rings .function_field .constructor import FunctionField
11
7
from sage .rings .polynomial .polynomial_ring_constructor import PolynomialRing
12
8
from sage .rings .integer import Integer
@@ -18,10 +14,42 @@ def test_finite_extension_from_limit_valuation():
18
14
y = R .gen ()
19
15
L = K .extension (y ** 2 - x )
20
16
v = K .valuation (Integer (1 ))
21
- w = v .extensions (L )
22
17
23
- for ext in w :
24
- # fewer max_runs, these are kind of slow
25
- TestSuite (ext ).run (verbose = True ,
26
- raise_on_failure = True ,
27
- max_runs = 512 )
18
+ return v .extensions (L )
19
+
20
+
21
+ @pytest .fixture
22
+ def w0 (w ):
23
+ return w [0 ]
24
+
25
+
26
+ @pytest .fixture
27
+ def w1 (w ):
28
+ return w [1 ]
29
+
30
+
31
+ # Use strings for the fixture names here, and then later convert them
32
+ # to the actual fixture objects using request.getfixturevalue(). This
33
+ # is a workaround for being unable to pass fixtures directly as
34
+ # parameters:
35
+ #
36
+ # https://github.com/pytest-dev/pytest/issues/349
37
+ #
38
+ extensions = ( "w0" , "w1" )
39
+
40
+
41
+ @pytest .mark .parametrize ("e" , extensions )
42
+ def test_finite_extension_from_limit_valuation (e , request ):
43
+ r"""
44
+ Run the ``TestSuite()`` for two examples given in the
45
+ ``FiniteExtensionFromLimitValuation`` documentation.
46
+ """
47
+ from sage .misc .sage_unittest import TestSuite
48
+
49
+ # Convert the string to a real fixture
50
+ e = request .getfixturevalue (e )
51
+
52
+ # fewer max_runs, these are kind of slow
53
+ TestSuite (e ).run (verbose = True ,
54
+ raise_on_failure = True ,
55
+ max_runs = 512 )
0 commit comments