|
4 | 4 | from pathlib import Path |
5 | 5 | import textwrap |
6 | 6 | import tomllib |
7 | | -from unittest import TestCase |
8 | 7 |
|
9 | 8 | import pytest |
10 | 9 |
|
@@ -103,24 +102,22 @@ def test_BUGWARRIORRC_empty(self): |
103 | 102 | assert load.get_config_path() == rc |
104 | 103 |
|
105 | 104 |
|
106 | | -class TestBugwarriorConfigParser(TestCase): |
107 | | - def setUp(self): |
108 | | - self.config = load.BugwarriorConfigParser() |
109 | | - self.config['general'] = { |
110 | | - 'someint': '4', |
111 | | - 'somenone': '', |
112 | | - 'somechar': 'somestring', |
113 | | - } |
| 105 | +class TestBugwarriorConfigParser: |
| 106 | + @pytest.fixture |
| 107 | + def config(self): |
| 108 | + config = load.BugwarriorConfigParser() |
| 109 | + config['general'] = {'someint': '4', 'somenone': '', 'somechar': 'somestring'} |
| 110 | + return config |
114 | 111 |
|
115 | | - def test_getint(self): |
116 | | - assert self.config.getint('general', 'someint') == 4 |
| 112 | + def test_getint(self, config): |
| 113 | + assert config.getint('general', 'someint') == 4 |
117 | 114 |
|
118 | | - def test_getint_none(self): |
119 | | - assert self.config.getint('general', 'somenone') is None |
| 115 | + def test_getint_none(self, config): |
| 116 | + assert config.getint('general', 'somenone') is None |
120 | 117 |
|
121 | | - def test_getint_valueerror(self): |
| 118 | + def test_getint_valueerror(self, config): |
122 | 119 | with pytest.raises(ValueError): |
123 | | - self.config.getint('general', 'somechar') |
| 120 | + config.getint('general', 'somechar') |
124 | 121 |
|
125 | 122 |
|
126 | 123 | class TestParseFile(LoadTest): |
|
0 commit comments