Skip to content

Commit 2ae1a99

Browse files
committed
unit test
1 parent 7c89080 commit 2ae1a99

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import importlib
2+
import sys
3+
import warnings
4+
from pathlib import Path
5+
6+
7+
def test_load_component_defs_with_extraneous_files_in_components_dir():
8+
# import the module
9+
# ensure module is added to path
10+
# capture warnings
11+
with warnings.catch_warnings(record=True) as w:
12+
sys.path.append(str(Path(__file__).parent / "extraneous_files_in_components_dir"))
13+
module = importlib.import_module("extraneous_files_in_components_dir.definitions")
14+
assert module is not None
15+
assert len(w) == 1
16+
assert (
17+
str(w[0].message)
18+
== "Found 1 Python files in the components root. Components expect all Python files to be nested in component subdirectories."
19+
)

python_modules/libraries/dagster-dg/dagster_dg_tests/cli_tests/test_component_type_commands.py

+14
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,20 @@ def test_component_type_docs_success():
112112
assert_runner_result(result)
113113

114114

115+
def test_component_type_docs_success_output_console():
116+
with ProxyRunner.test() as runner, isolated_components_venv(runner):
117+
result = runner.invoke(
118+
"component-type",
119+
"docs",
120+
"complex_schema_asset@dagster_components.test",
121+
"--output",
122+
"cli",
123+
)
124+
assert_runner_result(result)
125+
assert "<html" in result.output
126+
assert "An asset that has a complex params schema." in result.output
127+
128+
115129
def test_component_type_docs_with_no_dagster_components_fails() -> None:
116130
with (
117131
ProxyRunner.test() as runner,

0 commit comments

Comments
 (0)