File tree Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Expand file tree Collapse file tree 3 files changed +59
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ import sys
3
+
4
+ from contextlib import contextmanager
5
+
6
+
7
+ @contextmanager
8
+ def push_argv (argv ):
9
+ old_argv = sys .argv
10
+ sys .argv = argv
11
+ yield
12
+ sys .argv = old_argv
Original file line number Diff line number Diff line change
1
+
2
+ import pytest
3
+
4
+ import castxml
5
+
6
+ from . import push_argv
7
+
8
+
9
+ def _run (program , args ):
10
+ func = getattr (castxml , program )
11
+ args = ["%s.py" % program ] + args
12
+ with push_argv (args ), pytest .raises (SystemExit ) as excinfo :
13
+ func ()
14
+ assert 0 == excinfo .value .code
15
+
16
+
17
+ def test_castxml_module ():
18
+ _run ("castxml" , ["--version" ])
Original file line number Diff line number Diff line change
1
+
2
+ import os
3
+ import pytest
4
+
5
+ from path import Path
6
+
7
+ DIST_DIR = os .path .abspath (os .path .join (os .path .dirname (__file__ ), '../dist' ))
8
+
9
+
10
+ def _check_castxml_install (virtualenv , tmpdir ):
11
+ expected_version = "0.3.4"
12
+
13
+ for executable_name in ["castxml" ]:
14
+ output = virtualenv .run (
15
+ "%s --version" % executable_name , capture = True ).splitlines ()[0 ]
16
+ assert output == "%s version %s" % (executable_name , expected_version )
17
+
18
+
19
+ @pytest .mark .skipif (not Path (DIST_DIR ).exists (), reason = "dist directory does not exist" )
20
+ def test_wheel (virtualenv , tmpdir ):
21
+ wheels = Path (DIST_DIR ).files (match = "*.whl" )
22
+ if not wheels :
23
+ pytest .skip ("no wheel available" )
24
+ assert len (wheels ) == 1
25
+ print (wheels )
26
+
27
+ virtualenv .run ("pip install %s" % wheels [0 ])
28
+
29
+ _check_castxml_install (virtualenv , tmpdir )
You can’t perform that action at this time.
0 commit comments