@@ -24,10 +24,12 @@ def _pyproject():
2424@pytest .fixture (name = "empty_pyproject" )
2525def _empty_pyproject ():
2626 return {
27- "tool" : {"hatch" : {"metadata" : {"hooks" : {"fancy-pypi-readme" : {}}}}}
27+ "project" : {"dynamic" : ["foo" , "readme" , "bar" ]},
28+ "tool" : {"hatch" : {"metadata" : {"hooks" : {"fancy-pypi-readme" : {}}}}},
2829 }
2930
3031
32+ @pytest .mark .slow
3133class TestCLIEndToEnd :
3234 @pytest .mark .usefixtures ("new_project" )
3335 def test_missing_config (self ):
@@ -68,13 +70,26 @@ def test_ok_redirect(self, tmp_path):
6870
6971
7072class TestCLI :
71- @pytest .mark .usefixtures ("new_project" )
73+ def test_cli_run_missing_dynamic (self , capfd ):
74+ """
75+ Missing readme in dynamic is caught and gives helpful advice.
76+ """
77+ with pytest .raises (SystemExit ):
78+ cli_run ({}, sys .stdout )
79+
80+ out , err = capfd .readouterr ()
81+
82+ assert "You must add 'readme' to 'project.dynamic'.\n " == err
83+ assert "" == out
84+
7285 def test_cli_run_missing_config (self , capfd ):
7386 """
7487 Missing configuration is caught and gives helpful advice.
7588 """
7689 with pytest .raises (SystemExit ):
77- cli_run ({}, sys .stdout )
90+ cli_run (
91+ {"project" : {"dynamic" : ["foo" , "readme" , "bar" ]}}, sys .stdout
92+ )
7893
7994 out , err = capfd .readouterr ()
8095
0 commit comments