Test that stripping dev works.
(version, want, have_unstripped, monkeypatch)
| 330 | ], |
| 331 | ) |
| 332 | def test_strip_dev(version, want, have_unstripped, monkeypatch): |
| 333 | """Test that stripping dev works.""" |
| 334 | monkeypatch.setattr( |
| 335 | mne.utils.check, "import_module", lambda x: Bunch(__version__=version) |
| 336 | ) |
| 337 | got_have_unstripped, same_version = check_version( |
| 338 | version, want, strip=False, return_version=True |
| 339 | ) |
| 340 | assert same_version == version |
| 341 | assert got_have_unstripped is have_unstripped |
| 342 | have, simpler_version = check_version( |
| 343 | "foo", want, return_version=True |
| 344 | ) # strip=True is the default |
| 345 | assert have, (simpler_version, version) |
| 346 | |
| 347 | def looks_stable(version): |
| 348 | try: |
| 349 | [int(x) for x in version.split(".")] |
| 350 | except ValueError: |
| 351 | return False |
| 352 | else: |
| 353 | return True |
| 354 | |
| 355 | if looks_stable(version): |
| 356 | assert "dev" not in version |
| 357 | assert "rc" not in version |
| 358 | assert simpler_version == version |
| 359 | else: |
| 360 | assert simpler_version != version |
| 361 | assert "dev" not in simpler_version |
| 362 | assert "rc" not in simpler_version |
| 363 | assert not simpler_version.endswith(".") |
| 364 | assert looks_stable(simpler_version) |
| 365 | |
| 366 | |
| 367 | @testing.requires_testing_data |
nothing calls this directly
no test coverage detected