Skip to main content

Functional testing for command line applications

Project description

pipeline status coverage report PyPI

Scruf is a functional testing framework for command line applications. It is heavily inspired by cram. This is currently early in development and while I aim to maintain the current interface breaking changes may occur.

usage: scruf [-h] [--no-cleanup] [-s SHELL] [-i INDENT] [-e ENV_FILE]
             FILE [FILE ...]

positional arguments:
  FILE                  File(s) to be tested

optional arguments:
  -h, --help            show this help message and exit
  --no-cleanup          Avoid cleaning up temporary test directory
  -s SHELL, --shell SHELL
                        Path to shell to be used to run tests with. Default is
                        '/bin/sh'
  -i INDENT, --indent INDENT
                        String to be used for detecting indentation when
                        parsing tests. Default is 4 spaces, use a literal '\t'
                        to denote a tab character
  -e ENV_FILE, --env-file ENV_FILE
                        Name of config file to read environment variables from
  --version             show program's version number and exit
  --strict              Whether tests should be run in strict mode. In this
                        mode a test that does not check each line of output is
                        considered to have failed

Example test:

# in my_test.scf
# the following line is a test description
Verify 'cat' reads file contents
# Run some commands to setup environment
[SETUP]$ echo 'some text' > test.txt
[SETUP]$ echo '1234' >> test.txt
# The command to test (note indentation)
    $ cat test.txt
    some text
    [RE] ^\d+$

Running:

scruf my_test.scf
# Testing: my_test.scf
1..1
ok 1 - Verify 'cat' reads file contents

There are more examples under the examples/ directory in the source repo and in the documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scruf-0.4.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scruf-0.4.1-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file scruf-0.4.1.tar.gz.

File metadata

  • Download URL: scruf-0.4.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for scruf-0.4.1.tar.gz
Algorithm Hash digest
SHA256 a4b9e747d62d1a32d018875bad5e5c752ca27a141d51403c225823c72ffed866
MD5 0917fb15c7917eb804a8afd35aaa181f
BLAKE2b-256 5520644c25684f73fe8f9ad799ad9202cbd3e01e26700bb4c90e49c0d68a79fe

See more details on using hashes here.

File details

Details for the file scruf-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: scruf-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for scruf-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1446f7abe774040062532a7792cab4ad2f5760e76c1a94172bd0ff8a7d9c11ca
MD5 03eb66cf7f4355828f4c9ab9ece482a7
BLAKE2b-256 7078ad5ad9fc329be898afeffbf80b3be9d0935edc63df193060d0db81e24b45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page