Skip to content

Commit dd3f0a1

Browse files
Add interface tests
1 parent 8d77f5a commit dd3f0a1

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/usethis/_interface/docstyle.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import typer
44

55
from usethis._config import quiet_opt, usethis_config
6-
from usethis._config_file import files_manager
76
from usethis._core.docstyle import UnknownDocstringStyleError, use_docstyle
87

98

@@ -18,5 +17,5 @@ def docstyle(
1817
msg = f"Invalid docstring style: {style}. Choose from 'numpy', 'google', or 'pep257'."
1918
raise UnknownDocstringStyleError(msg)
2019

21-
with usethis_config.set(quiet=quiet), files_manager():
20+
with usethis_config.set(quiet=quiet):
2221
use_docstyle(style)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
5+
from usethis._config_file import files_manager
6+
from usethis._interface.docstyle import docstyle
7+
from usethis._test import change_cwd
8+
9+
10+
class TestDocstyle:
11+
def test_invalid_style(self):
12+
with pytest.raises(ValueError, match="Invalid docstring style"):
13+
docstyle("invalid_style")
14+
15+
def test_google_runs(self, tmp_path: Path):
16+
with change_cwd(tmp_path), files_manager():
17+
docstyle("google")

0 commit comments

Comments
 (0)