(pytester: Pytester)
| 230 | |
| 231 | |
| 232 | def test_cache_show(pytester: Pytester) -> None: |
| 233 | result = pytester.runpytest("--cache-show") |
| 234 | assert result.ret == 0 |
| 235 | result.stdout.fnmatch_lines(["*cache is empty*"]) |
| 236 | pytester.makeconftest( |
| 237 | """ |
| 238 | def pytest_configure(config): |
| 239 | config.cache.set("my/name", [1,2,3]) |
| 240 | config.cache.set("my/hello", "world") |
| 241 | config.cache.set("other/some", {1:2}) |
| 242 | dp = config.cache.mkdir("mydb") |
| 243 | dp.joinpath("hello").touch() |
| 244 | dp.joinpath("world").touch() |
| 245 | """ |
| 246 | ) |
| 247 | result = pytester.runpytest() |
| 248 | assert result.ret == 5 # no tests executed |
| 249 | |
| 250 | result = pytester.runpytest("--cache-show") |
| 251 | result.stdout.fnmatch_lines( |
| 252 | [ |
| 253 | "*cachedir:*", |
| 254 | "*- cache values for '[*]' -*", |
| 255 | "cache/nodeids contains:", |
| 256 | "my/name contains:", |
| 257 | " [1, 2, 3]", |
| 258 | "other/some contains:", |
| 259 | " {*'1': 2}", |
| 260 | "*- cache directories for '[*]' -*", |
| 261 | "*mydb/hello*length 0*", |
| 262 | "*mydb/world*length 0*", |
| 263 | ] |
| 264 | ) |
| 265 | assert result.ret == 0 |
| 266 | |
| 267 | result = pytester.runpytest("--cache-show", "*/hello") |
| 268 | result.stdout.fnmatch_lines( |
| 269 | [ |
| 270 | "*cachedir:*", |
| 271 | "*- cache values for '[*]/hello' -*", |
| 272 | "my/hello contains:", |
| 273 | " *'world'", |
| 274 | "*- cache directories for '[*]/hello' -*", |
| 275 | "d/mydb/hello*length 0*", |
| 276 | ] |
| 277 | ) |
| 278 | stdout = result.stdout.str() |
| 279 | assert "other/some" not in stdout |
| 280 | assert "d/mydb/world" not in stdout |
| 281 | assert result.ret == 0 |
| 282 | |
| 283 | |
| 284 | class TestLastFailed: |
nothing calls this directly
no test coverage detected