Metadata-Version: 2.4
Name: scripttester
Version: 0.2.0
Summary: Utility for testing command line scripts
Author-email: Matthew Brett <matthew.brett@gmail.com>
Maintainer-email: Matthew Brett <matthew.brett@gmail.com>
License-Expression: BSD-2-Clause
Project-URL: Homepage, https://github.com/matthew-brett/scripttester
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
Description-Content-Type: text/x-rst
License-File: LICENSE
Provides-Extra: doc
Requires-Dist: ghp-import; extra == "doc"
Requires-Dist: sphinx; extra == "doc"
Requires-Dist: numpydoc; extra == "doc"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: setuptools; extra == "test"
Dynamic: license-file

#######################################################
ScriptTester - utility for testing command line scripts
#######################################################

.. shared-text-body

**********
Quickstart
**********

Provides class to be instantiated in tests that check that scripts can be run
and give correct output.  Usually works something like this in a test module::

    import mymodule
    from scripttester import ScriptTester
    runner = ScriptTester(mymodule)

Then, in the tests, something like::

    code, stdout, stderr = runner.run_command(['my-script', my_arg])
    assert code == 0
    assert stdout == b'This script ran OK'

The class aims to find your scripts whether you have installed (with ``pip
install .`` or ``pip install -e .`` or ``python setup.py install``), or not.
If you have not installed, the scripts will not be on your system PATH, and we
have to find them.  The heuristic is to look (by default) in the directory
containing ``mymodule``; if there is a ``setup.py`` file there, and a
``scripts`` sub-directory, assume that directory contains the scripts.

Note there is no way of using this not-installed mechanism to find entrypoint
scripts, that have not been installed. To find these, we would have to run the
``setup.py`` file.

************
Installation
************

::

    pip install scripttester

****
Code
****

See https://github.com/matthew-brett/scripttester

Released under the BSD two-clause license - see the file ``LICENSE`` in the
source distribution.

GitHub Actions tests the code automatically under Python versions 3.11
through 3.15, on Linux, macOS and Windows.

The latest released version is at https://pypi.python.org/pypi/scripttester

*****
Tests
*****

* Install ``scripttester``
* Install the pytest_ testing framework::

    pip install pytest

* Run the tests with::

    py.test --pyargs scripttester

*******
Support
*******

Please put up issues on the `scripttester issue tracker`_.

.. standalone-references

.. |scripttester-documentation| replace:: `scripttester documentation`_
.. _scripttester documentation:
    https://matthew-brett.github.com/scripttester/scripttester.html
.. _documentation: https://matthew-brett.github.com/scripttester
.. _pandoc: http://pandoc.org
.. _jupyter: jupyter.org
.. _homebrew: brew.sh
.. _sphinx: http://sphinx-doc.org
.. _rest: http://docutils.sourceforge.net/rst.html
.. _scripttester issue tracker: https://github.com/matthew-brett/scripttester/issues
.. _pytest: https://pytest.readthedocs.io
.. _mock: https://github.com/testing-cabal/mock
