@@ -36,8 +36,8 @@ Start with a simple set of functional tests:
3636 installed)
3737- Is command XYZ available? etc. Cover your entire CLI usage here!
3838
39- This is almost a stupid exercise: Run the command as a shell command
40- and inspect the exit code of the exiting process, e.g.
39+ This is almost a stupid exercise: Run the command as a :func: ` ~cli_test_helpers. shell`
40+ command and inspect the exit code of the exiting process, e.g.
4141
4242.. code-block :: python
4343
@@ -67,7 +67,8 @@ Then you're ready to take advantage of our helpers.
6767``ArgvContext ``
6868+++++++++++++++
6969
70- ``ArgvContext `` allows you to mimic the use of specific CLI arguments:
70+ :class: `~cli_test_helpers.ArgvContext ` allows you to mimic the use of
71+ specific CLI arguments:
7172
7273.. code-block :: python
7374
@@ -96,8 +97,8 @@ See more |example code (argparse-cli)|_.
9697``EnvironContext ``
9798++++++++++++++++++
9899
99- `` EnvironContext `` allows you to mimic the presence (or absence) of
100- environment variables:
100+ :class: ` ~cli_test_helpers. EnvironContext ` allows you to mimic the presence
101+ (or absence) of environment variables:
101102
102103.. code-block :: python
103104
@@ -112,6 +113,20 @@ environment variables:
112113
113114 See more |example code (click-command) |_.
114115
116+ ``RandomDirectoryContext ``
117+ ++++++++++++++++++++++++++
118+
119+ :class: `~cli_test_helpers.RandomDirectoryContext ` allows you to verify that
120+ your CLI program logic is independent of where it is executed in the file
121+ system:
122+
123+ .. code-block :: python
124+
125+ def test_load_configfile ():
126+ """ Must not fail when executed anywhere in the filesystem."""
127+ with ArgvContext(' foobar' , ' load' ), RandomDirectoryContext():
128+ foobar.cli.main()
129+
115130
116131 .. |example code (argparse-cli) | replace :: example code
117132.. |example code (click-cli) | replace :: example code
0 commit comments