99class PipInstallTest (unittest .TestCase ):
1010 maxDiff = None
1111
12- def test_entry_point (self ):
13- env = os .environ .get ("WHEEL_ENTRY_POINT " )
12+ def test_entry_point_void_return (self ):
13+ env = os .environ .get ("YAMLLINT_ENTRY_POINT " )
1414 self .assertIsNotNone (env )
1515
1616 entry_point = Path (env )
@@ -19,6 +19,27 @@ def test_entry_point(self):
1919 proc = subprocess .run ([entry_point , "--version" ], check = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
2020 self .assertEqual (proc .stdout .decode ("utf-8" ).strip (), "yamllint 1.26.3" )
2121
22+ # yamllint entry_point is of the form `def run(argv=None):`
23+ with self .assertRaises (subprocess .CalledProcessError ) as context :
24+ subprocess .run ([entry_point , "--option-does-not-exist" ], check = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
25+ self .assertIn ('returned non-zero exit status 2' , str (context .exception ))
26+
27+ def test_entry_point_int_return (self ):
28+ env = os .environ .get ("SPHINX_BUILD_ENTRY_POINT" )
29+ self .assertIsNotNone (env )
30+
31+ entry_point = Path (env )
32+ self .assertTrue (entry_point .exists ())
33+
34+ proc = subprocess .run ([entry_point , "--version" ], check = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
35+ # sphinx-build uses args[0] for its name, only assert the version here
36+ self .assertTrue (proc .stdout .decode ("utf-8" ).strip ().endswith ('4.2.0' ))
37+
38+ # sphinx-build entry_point is of the form `def main(argv: List[str] = sys.argv[1:]) -> int:`
39+ with self .assertRaises (subprocess .CalledProcessError ) as context :
40+ subprocess .run ([entry_point , "--option-does-not-exist" ], check = True , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
41+ self .assertIn ('returned non-zero exit status 2' , str (context .exception ))
42+
2243 def test_data (self ):
2344 env = os .environ .get ("WHEEL_DATA_CONTENTS" )
2445 self .assertIsNotNone (env )
0 commit comments