From e2237933447acd5e3910116da1a66c77fe6b29c3 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Wed, 24 Feb 2021 08:07:32 +0100 Subject: Updated README instructions --- README.md | 34 ++++++++++++++-------------------- minishell_test/args.py | 18 +++++++++--------- setup.cfg | 4 ++-- 3 files changed, 25 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 74b199e..7d9212f 100644 --- a/README.md +++ b/README.md @@ -17,18 +17,19 @@ $ pip3 install minishell-test ``` $ git clone https://github.com/cacharle/minishell_test $ cd minishell_test -$ pip3 install -e minishell_test +$ pip3 install -e . ``` ## Usage -The default path to your project is `../minishell` but you can change it the the [configuration](src/config.py). - ``` -$ ./run # run all tests +$ minishell_test # In your project directory +$ python3 -m minishell_test # If you don't have ~/.brew/bin or ~/.local/bin in your PATH -$ ./run --help -usage: run [-h] [-k] [-r BEGIN END] [--show-range] [-x] [-v] [-b] [-n] [-l] [-m] [-g] [suite ...] +$ minishell_test --help +usage: minishell_test [-h] [-p PATH] [-l] [-k] [-r BEGIN END] [--show-range] + [-x] [-v] [-b] [-n] [-m] [-g] + [suite [suite ...]] Test for the minishell project of school 42. @@ -39,6 +40,8 @@ positional arguments: optional arguments: -h, --help show this help message and exit + -p PATH, --path PATH Path to minishell directory + -l, --list Print available test suites -k, --check-leaks Run valgrind on tests (disable usual comparison with bash) -r BEGIN END, --range BEGIN END Range of test index to run (imply --show-index) @@ -47,13 +50,8 @@ optional arguments: -v, --verbose Increase verbosity level (e.g -vv == 2) -b, --bonus Enable bonus tests -n, --no-bonus Disable bonus tests - -l, --list Print available test suites -m, --make Make minishell and exit -g, --pager After running the test, display the result in a pager of your choice - -Made by cacharle -https://github.com/cacharle -https://cacharle.xyz ``` ## Test compatibility @@ -75,8 +73,6 @@ README.md test.sh With this setup `argv[2]` is what you would usually get in `line` from `get_next_line`. This allows you to set the prompt to whatever you want. -**This test works with Python3.6 or higher.** - ### Environement variables My test only gives the `PATH=minishell_test/bin` and `TERM=xterm-256color` environment variables to your minishell. @@ -85,16 +81,14 @@ You can test this quickly with the [try](try) script (e.g `./try 'echo bonjour | ## Bonus -Their is 3 different method to enable the bonus tests: - -* Force the bonus tests with `./run -b` -* Change the `BONUS` variable in [config.py](src/config.py) to True +* Force the bonus tests with `$ minishell_test -b` +* Change the `BONUS` variable in [config.py](minishell_test/config.py) to True * Set the environment variable `MINISHELL_TEST_BONUS` to `yes` (e.g `echo 'export MINISHELL_TEST_BONUS=yes' >> ~/.zshrc`) ## Memory leaks -`./run -k`, checkout the `--show-range`, `--range` and `-x` options to help +`$ minishell_test -k`, checkout the `--show-range`, `--range` and `-x` options to help to select the tests to run since valgrind is really slow. ## Don't check error messages @@ -111,7 +105,7 @@ The tester will try to convert to output/status code of bash on Linux to the one ## Add new tests -You can find the suites in the [src/suites](src/suites) directory. +You can find the suites in the [minishell\_test/suites](minishell_test/suites) directory. ### Add individual test @@ -152,5 +146,5 @@ def suite_yoursuitename(test): ## Wildcard (or glob) -There is a commented glob suite in [src/suites/preprocess.py](src/suites/preprocess.py). +There is a commented glob suite in [minishell\_test/suites/preprocess.py](minishell_test/suites/preprocess.py). Good luck handling `*'.*'`. diff --git a/minishell_test/args.py b/minishell_test/args.py index 3dd124f..e88ae7f 100644 --- a/minishell_test/args.py +++ b/minishell_test/args.py @@ -6,7 +6,7 @@ # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:32 by charles #+# #+# # -# Updated: 2021/02/05 20:38:28 by charles ### ########.fr # +# Updated: 2021/02/24 08:03:17 by cacharle ### ########.fr # # # # ############################################################################ # @@ -26,6 +26,14 @@ def parse_args(): Made by cacharle - https://cacharle.xyz """) ) + parser.add_argument( + "-p", "--path", default=config.MINISHELL_DIR, + help="Path to minishell directory" + ) + parser.add_argument( + "-l", "--list", action="store_true", + help="Print available test suites" + ) parser.add_argument( "-k", "--check-leaks", action="store_true", help="Run valgrind on tests (disable usual comparison with bash)" @@ -54,10 +62,6 @@ def parse_args(): "-n", "--no-bonus", action="store_true", help="Disable bonus tests" ) - parser.add_argument( - "-l", "--list", action="store_true", - help="Print available test suites" - ) parser.add_argument( "-m", "--make", action="store_true", help="Make minishell and exit" @@ -66,10 +70,6 @@ def parse_args(): "-g", "--pager", action="store_true", help="After running the test, display the result in a pager of your choice" ) - parser.add_argument( - "-p", "--path", default=config.MINISHELL_DIR, - help="Path to minishell directory" - ) parser.add_argument( "suites", nargs='*', metavar="suite", help=textwrap.dedent("""\ diff --git a/setup.cfg b/setup.cfg index 535977c..9eea9b7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = minishell_test -version = 1.0.0 +version = 1.0.1 license = GPL2 license_file = LICENSE description = test for the minishell project of school 42 @@ -30,7 +30,7 @@ python_requires = >=3.6 [options.entry_points] console_scripts = - minishell-test = minishell_test.__main__:main + minishell_test = minishell_test.__main__:main [flake8] ignore = E501,E221,W504,E241 -- cgit