Coder Social home page Coder Social logo

ionelmc / python-process-tests Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 1.0 78 KB

Testcase classes and assertions for testing processes.

Home Page: https://pypi.python.org/pypi/process-tests

License: BSD 2-Clause "Simplified" License

Python 100.00%

python-process-tests's Introduction

Overview

tests
GitHub Actions Build Status
package
PyPI Package latest release PyPI Wheel Supported versions Supported implementations
Commits since latest release

Tools for testing processes.

  • Free software: BSD 2-Clause License

Usage

from process_tests import ProcessTestCase
from process_tests import TestProcess

class MyTestCase(ProcessTestCase):
    def test_simple(self):
        with TestProcess('mydaemon', 'arg1', 'arg2') as proc:
            with self.dump_on_error(proc.read):
                self.wait_for_strings(proc.read, 10, # wait 10 seconds for process to output lines with these strings
                    'Started',
                    'Working',
                    'Done',
                )

Features

  • TODO

Examples

TODO

  • tests
  • docs

Requirements

OS

Any

Runtime

Python 2.6, 2.7, 3.2, 3.3 or PyPy

Similar projects

  • TODO

python-process-tests's People

Contributors

ionelmc avatar bitdeli-chef avatar kloczek avatar

Stargazers

gc-ss avatar Skurikhin Alexandr avatar Dmitrii I avatar  avatar salotz avatar  avatar Jesaja Everling avatar Alonisser avatar  avatar

Watchers

Jesaja Everling avatar  avatar  avatar James Cloos avatar  avatar

Forkers

sysfce2

python-process-tests's Issues

I can start a TestProcess("docker-compose", "up") but how to stop it?

@pytest.fixture(scope="session")
def app_server():
    with TestProcess("docker-compose", "up") as app_server:
        wait_for_strings(app_server.read, 60, "Booting worker")
        print(app_server.read())
        yield app_server
        print("\n>>>>Teardown app_service")

This is doing fine, but the teardown is not happening (docker ps shows my apps still running)

I added this line app_server.close("docker-compose stop") in a desperate guess, for no avail.

Would you have a suggestion on how act here?

RFE: is it possible to start making github releases?๐Ÿค”

On create github release entry is created email notification to those whom have set in your repo the web UI Watch->Releases.
gh release can contain additional comments (li changelog) or additional assets like release tar balls (by default it contains only assets from git tag) however all those part are not obligatory.
In simplest variant gh release can be empty because subiekt of the sent email contains git tag name.

I'm asking because my automation process uses those email notifications by trying to make preliminary automated upgrades of building packages, which allows saving some time on maintaining packaging procedures.
Probably other people may be interested to be instantly informed about release new version as well.

Documentation and examples of generate gh releases:
https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
https://cli.github.com/manual/gh_release_upload/
jbms/sphinx-immaterial#282
https://github.com/marketplace/actions/github-release
https://pgjones.dev/blog/trusted-plublishing-2023/
jbms/sphinx-immaterial#281 (comment)
tox target to publish on pypi and make gh release https://github.com/jaraco/skeleton/blob/928e9a86d61d3a660948bcba7689f90216cc8243/tox.ini#L42-L58

3.0.0: pytest is failing in one unit

3.0.0 + #5
and pytest is failing

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-process-tests-3.0.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-process-tests-3.0.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' --exit-0-if-no-units
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.3, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-process-tests-3.0.0
configfile: pytest.ini
testpaths: tests
collected 3 items

tests/test_process_tests.py ..F                                          [100%]

=================================== FAILURES ===================================
_________________________________ test_socket __________________________________
tests/test_process_tests.py:36: in test_socket
    wait_for_strings(proc.read, TIMEOUT, 'Serving HTTP on')
../../BUILDROOT/python-process-tests-3.0.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/process_tests.py:246: in wait_for_strings
    raise AssertionError(f'Waited {seconds:0.2f}secs but {check_strings} did not appear in output in the given order !')
E   AssertionError: Waited 60.00secs but ['Serving HTTP on'] did not appear in output in the given order !
----------------------------- Captured stdout call -----------------------------
********************************************** SERVER **********************************************

****************************************************************************************************
=========================== short test summary info ============================
FAILED tests/test_process_tests.py::test_socket - AssertionError: Waited 60.0...
==================== 1 failed, 2 passed in 61.65s (0:01:01) ====================
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:95: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-8b7a16b5-3c9f-40c8-aa6e-b7863d30de57/test_safe_get_no_perms0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_safe_get_no_perms0'
  warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:95: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-8b7a16b5-3c9f-40c8-aa6e-b7863d30de57/test_safe_set_no_perms0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_safe_set_no_perms0'
  warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:95: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-8b7a16b5-3c9f-40c8-aa6e-b7863d30de57/test_safe_delete_no_perms0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_safe_delete_no_perms0'
  warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:95: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-8b7a16b5-3c9f-40c8-aa6e-b7863d30de57/test_rmtree_errorhandler_reado0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_rmtree_errorhandler_reado0'
  warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:95: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-8b7a16b5-3c9f-40c8-aa6e-b7863d30de57/test_rmtree_errorhandler_rerai0
<class 'OSError'>: [Errno 39] Directory not empty: 'test_rmtree_errorhandler_rerai0'
  warnings.warn(
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:95: PytestWarning: (rm_rf) error removing /tmp/pytest-of-tkloczko/garbage-8b7a16b5-3c9f-40c8-aa6e-b7863d30de57
<class 'OSError'>: [Errno 39] Directory not empty: '/tmp/pytest-of-tkloczko/garbage-8b7a16b5-3c9f-40c8-aa6e-b7863d30de57'
  warnings.warn(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.