Test mne setup_source_space.
(tmp_path)
| 466 | |
| 467 | @testing.requires_testing_data |
| 468 | def test_setup_source_space(tmp_path): |
| 469 | """Test mne setup_source_space.""" |
| 470 | pytest.importorskip("nibabel") |
| 471 | check_usage(mne_setup_source_space, force_help=True) |
| 472 | # Using the sample dataset |
| 473 | use_fname = op.join(tmp_path, "sources-src.fif") |
| 474 | # Test command |
| 475 | with ArgvSetter( |
| 476 | ( |
| 477 | "--src", |
| 478 | use_fname, |
| 479 | "-d", |
| 480 | subjects_dir, |
| 481 | "-s", |
| 482 | "sample", |
| 483 | "--morph", |
| 484 | "sample", |
| 485 | "--add-dist", |
| 486 | "False", |
| 487 | "--ico", |
| 488 | "3", |
| 489 | "--verbose", |
| 490 | ) |
| 491 | ): |
| 492 | mne_setup_source_space.run() |
| 493 | src = read_source_spaces(use_fname) |
| 494 | assert len(src) == 2 |
| 495 | with pytest.raises(Exception): |
| 496 | with ArgvSetter( |
| 497 | ( |
| 498 | "--src", |
| 499 | use_fname, |
| 500 | "-d", |
| 501 | subjects_dir, |
| 502 | "-s", |
| 503 | "sample", |
| 504 | "--ico", |
| 505 | "3", |
| 506 | "--oct", |
| 507 | "3", |
| 508 | ) |
| 509 | ): |
| 510 | assert mne_setup_source_space.run() |
| 511 | with pytest.raises(Exception): |
| 512 | with ArgvSetter( |
| 513 | ( |
| 514 | "--src", |
| 515 | use_fname, |
| 516 | "-d", |
| 517 | subjects_dir, |
| 518 | "-s", |
| 519 | "sample", |
| 520 | "--ico", |
| 521 | "3", |
| 522 | "--spacing", |
| 523 | "10", |
| 524 | ) |
| 525 | ): |
nothing calls this directly
no test coverage detected