(pytester: Pytester)
| 210 | |
| 211 | |
| 212 | def test_cache_show(pytester: Pytester) -> None: |
| 213 | result = pytester.runpytest("--cache-show") |
| 214 | assert result.ret == 0 |
| 215 | result.stdout.fnmatch_lines(["*cache is empty*"]) |
| 216 | pytester.makeconftest( |
| 217 | """ |
| 218 | def pytest_configure(config): |
| 219 | config.cache.set("my/name", [1,2,3]) |
| 220 | config.cache.set("my/hello", "world") |
| 221 | config.cache.set("other/some", {1:2}) |
| 222 | dp = config.cache.mkdir("mydb") |
| 223 | dp.joinpath("hello").touch() |
| 224 | dp.joinpath("world").touch() |
| 225 | """ |
| 226 | ) |
| 227 | result = pytester.runpytest() |
| 228 | assert result.ret == 5 # no tests executed |
| 229 | |
| 230 | result = pytester.runpytest("--cache-show") |
| 231 | result.stdout.fnmatch_lines( |
| 232 | [ |
| 233 | "*cachedir:*", |
| 234 | "*- cache values for '[*]' -*", |
| 235 | "cache/nodeids contains:", |
| 236 | "my/name contains:", |
| 237 | " [1, 2, 3]", |
| 238 | "other/some contains:", |
| 239 | " {*'1': 2}", |
| 240 | "*- cache directories for '[*]' -*", |
| 241 | "*mydb/hello*length 0*", |
| 242 | "*mydb/world*length 0*", |
| 243 | ] |
| 244 | ) |
| 245 | assert result.ret == 0 |
| 246 | |
| 247 | result = pytester.runpytest("--cache-show", "*/hello") |
| 248 | result.stdout.fnmatch_lines( |
| 249 | [ |
| 250 | "*cachedir:*", |
| 251 | "*- cache values for '[*]/hello' -*", |
| 252 | "my/hello contains:", |
| 253 | " *'world'", |
| 254 | "*- cache directories for '[*]/hello' -*", |
| 255 | "d/mydb/hello*length 0*", |
| 256 | ] |
| 257 | ) |
| 258 | stdout = result.stdout.str() |
| 259 | assert "other/some" not in stdout |
| 260 | assert "d/mydb/world" not in stdout |
| 261 | assert result.ret == 0 |
| 262 | |
| 263 | |
| 264 | class TestLastFailed: |
nothing calls this directly
no test coverage detected