{ "info": { "author": "Lotus Engineering, LLC", "author_email": "dominic_valentino@lotusengineeringllc.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "\n# The qspypy package \nThe **qspypy** package is a rewrite of the existing Tcl qspy and qutest scripts \nusing Python 3.6. \n\nThis package currently contains two main modules: **qspy** and **qutest**. \n\nAt some point in the future, the **qspyview** front end may be added as well. \nSince Python comes with Tk, the translation effort shouldn't be too great.\n\n## The qspy module\nThe qspy module is the interface to the qspy back end application that ultimately \ninterfaces with the target. This module provides a series of message send and \ncallback methods so that knowledge of communications is hidden from qutest. \n\n## The qutest module\nThe qutest module is designed to be run using the powerful\n[pytest](https://pytest.org/) Python testing framework. \n\nPytest makes it easy to discover and run your qutest scripts, \nin addition to a host of other features like jUnit XML output for Jenkins \nand hundreds of other plugins.\n\nFinally, qutest provides the added feature of automatically starting qspy \nfor you (assuming it's on your path) at the start of every test session. This \nbehavior and other options can be customized via the standard _conftest.py_ \npytest configuration script.\n\n# Installation\nInstallation is through pip:\n\n```pip3 install qspypy```\n\n\n# Tcl Script Conversion\nAs of qspypy 1.1.0, a new system wide command line utility is provided called \n**qutest_convert**. \n\nThis script can do _most_ of the conversion of a test script\nfrom Tcl to Python for you (e.g. it doesn't convert Tcl binary format to Python \nstruck.pack). \n\nSimply provide the list of Tcl test files to convert, for example:\n```\nqutest_convert test_table.tcl test_philo.tcl\n```\nIn additon, this utility will create a default _conftest.py_.\n\n# Test Creation and Test Fixtures\nIf you understand how the existing Tcl based qutest scripts are written,\nit should not be too difficult for you to understand the qutest/pytest versions.\n\nEach pytest test function can derive from one or more test fixtures. These\ntest fixtures (defined in the qspypy.fixtures module) provide a context for \ntests and execute before (and optionally after with a _yield_) each test. \nFixtures replace the standard xUnit setUp and tearDown methods.\n\nQspypy provides two basic test fixtures for you to use for your tests: \n**qutest** and **qutest_noreset**. \n\nQutest and qutest_norest both provide the same per-test context,\nbut qutest_noreset does not reset the target. Both of these contexts contain\nthe qutest_context methods that are identical (except for Coninue) to the \nqutest.tcl procedure names.\n\nIn addition to these, you can provide your own common test fixture, either in\n_conftest.py_ for global access or in each individual script.\n\n## Example from qpcpp version 6.3.2\nHere is a part of the dpp _test_philo.py_ test script. \nThe full example of this and the _test_table.py_ is available on\n[GitHub](https://github.com/LotusEngineering/qpboost/tree/master/qspypy/tests).\n\n```\nimport sys\nimport pytest\nimport struct\nfrom qspypy.qspy import FILTER, QS_OBJ_KIND\n\n\ndef on_reset(qutest):\n \"\"\" Common reset handler called by qutest after resetting target \"\"\"\n\n qutest.expect_pause()\n qutest.glb_filter(FILTER.SM)\n qutest.loc_filter(QS_OBJ_KIND.SM_AO, 'AO_Philo<2>')\n qutest.Continue() # note continue in lower case. is a reserved word in python\n qutest.expect(\"===RTC===> St-Init Obj=AO_Philo<2>,State=QP::QHsm::top->thinking\")\n qutest.expect(\"===RTC===> St-Entry Obj=AO_Philo<2>,State=thinking\")\n qutest.expect(\"%timestamp Init===> Obj=AO_Philo<2>,State=thinking\")\n qutest.glb_filter(FILTER.SM, FILTER.AO, FILTER.UA)\n qutest.current_obj(QS_OBJ_KIND.SM_AO, 'AO_Philo<2>')\n\n\ndef test_TIMEOUT_Philo_post(qutest):\n qutest.post('TIMEOUT_SIG')\n qutest.expect(\"%timestamp AO-Post Sdr=QS_RX,Obj=AO_Philo<2>,Evt,Evt Obj=AO_Philo<2>,Sig=TIMEOUT_SIG,State=thinking\")\n qutest.expect(\"===RTC===> St-Exit Obj=AO_Philo<2>,State=thinking\")\n qutest.expect(\"===RTC===> St-Entry Obj=AO_Philo<2>,State=hungry\")\n qutest.expect(\"%timestamp ===>Tran Obj=AO_Philo<2>,Sig=TIMEOUT_SIG,State=thinking->hungry\")\n qutest.expect(\"%timestamp Trg-Done QS_RX_EVENT\")\n\ndef test_publish_EAT_2(qutest_noreset): \n qutest = qutest_noreset # Rename for consistancy\n qutest.loc_filter(QS_OBJ_KIND.SM_AO, 'AO_Philo<2>')\n qutest.publish('EAT_SIG', struct.pack('< B', 2)) # Send byte of value 2\n qutest.expect(\"%timestamp AO-Post Sdr=QS_RX,Obj=AO_Philo<2>,Evt,Evt Obj=AO_Philo<2>,Sig=EAT_SIG,State=hungry\")\n qutest.expect(\"%timestamp BSP_CALL BSP::random 123\")\n qutest.expect(\"===RTC===> St-Entry Obj=AO_Philo<2>,State=eating\")\n qutest.expect(\"%timestamp ===>Tran Obj=AO_Philo<2>,Sig=EAT_SIG,State=hungry->eating\")\n qutest.expect(\"%timestamp Trg-Done QS_RX_EVENT\")\n\n```\n\n**NOTE** In order to send arbitrary binary packet data, Python's \n[struct](https://docs.python.org/3/library/struct.html) class can be used. \n\nFor example:\n```\n qutest.dispatch('EAT_SIG', struct.pack('< B', 2))\n```\n\n# Configurion and Running Tests\nIn order to run a python qutest script, you need to provide a standard pytest \n_conftest.py_ configuration file. This file needs no modifications to use the \nnew qutest command line tool.\n\nThe file must contain the following at a minimum:\n\n```\n#\n# pytest configuration file\n#\n\n# Load common fixtures used throughout testing\nfrom qspypy.fixtures import session, reset, module, qutest, qutest_noreset \n```\nAlternatively, this file can be modified to change the behavior of qutest by \nmodifying its configuration. \n\nFor example, to have the qspy backend start automatically, add the following:\n```\n# Load default configuration so we can change it before running\nimport qspypy.config as CONFIG\n\n# Automatically start/stop qspy for the session\nCONFIG.AUTOSTART_QSPY = True\n\n## NOTE: You must change this to be the port your target is connected to\nCONFIG.QSPY_COM_PORT = 'COM3'\n\n```\n\n## Test execution\nThe qspypy package creates a system wide executable **qutest** that provides\nthe identical interface at the existing qutest.tcl script.\n\nFor example, to run all of the dpp mingw example test scripts you would enter\nthe following terminal command in /examples/qutest/dpp: \n\n```\nqutest *.py mingw/test_dpp.exe\n\n```\n\nWhich produces the following output:\n\n```\n============================= test session starts =============================\nplatform win32 -- Python 3.6.4, pytest-3.6.1, py-1.5.3, pluggy-0.6.0 -- c:\\tools\\python\\python36\\python.exe\ncachedir: .pytest_cache\nrootdir: C:\\tools\\qp\\qpcpp_6.3.2\\examples\\qutest\\dpp, inifile:\ncollected 8 items\n\ntest_philo.py::test_TIMEOUT_Philo_post PASSED [ 12%]\ntest_philo.py::test_publish_EAT_2 PASSED [ 25%]\ntest_philo.py::test_TIMEOUT_Philo_thinking_ASSERT PASSED [ 37%]\ntest_philo.py::test_TIMEOUT_Philo_eating_PUBLISH_from_AO PASSED [ 50%]\ntest_philo.py::test_timeEvt_Philo_tick PASSED [ 62%]\ntest_table.py::test_PAUSE_Table PASSED [ 75%]\ntest_table.py::test_SERVE_Table_1 PASSED [ 87%]\ntest_table.py::test_SERVE_Table_2 PASSED [100%]\n\n========================== 8 passed in 10.13 seconds ==========================\n```\n\n\n\n# Known Issues\n- Support for config.AUTOSTART_QSPY mac not tested\n- Potential issue with dropped characters on linux\n\n# Release Notes\n## 1.1.0\n- Added missing qutest: fill, peek, poke\n- Added command line tool **qutestpy** which is interface compatible with existing\nqutest.tcl script.\n- Added command line tool **qutestpy_convert** to convert tcl scripts to python.\n- Fixed bug with missing setup and teardown calls.\n- Qutest will no longer show a console for local targets, this can be changed by\nsetting LOCAL_TARGET_USES_CONSOLE to True.\n- Added new configuration QSPY_LOCAL_UDP_PORT to specify local UDP port.\n- Simplifed test fixtures to just require qutest or qutest_noreset.\n- Added reset, setup and teardown callbacks via registration in module fixture.\n- No longer kills local_target process but relies on reset message only.\n- Added remaining test examples\n\n\n## 1.0.1\n- Fixed crash on linux\n- Added config.AUTOSTART_QSPY support for linux via gnome-terminal\n- Now defaults to config.AUTOSTART_QSPY to False \n\n## 1.0.0\n- Initial release to PyPi\n\n# Source File Description\nFile | Descripton\n---- | ----------\nconfig.py | Configuration values used in qutest.py \nfixtures.py | pytest fixtures to used in the user's conftest.py\nqspy.py | The Python implementation of the qspy.tcl qspy interface library\nqutest.py | The Python implementaition of qutest.tcl\nqutest_convert.py | Command line tool for file Tcl to Python conversion\ntests | Directory containing Python versions of test scripts\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/LotusEngineering/qpboost/tree/master/qspypy", "keywords": "qp qpcpp qtools qpc qutest", "license": "", "maintainer": "", "maintainer_email": "", "name": "qspypy", "package_url": "https://pypi.org/project/qspypy/", "platform": "", "project_url": "https://pypi.org/project/qspypy/", "project_urls": { "Homepage": "https://github.com/LotusEngineering/qpboost/tree/master/qspypy" }, "release_url": "https://pypi.org/project/qspypy/1.1.0/", "requires_dist": [ "pytest (>=3.6.1)" ], "requires_python": "", "summary": "Python implementation of qspy Tcl scripts", "version": "1.1.0" }, "last_serial": 4043775, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "d6c18b225387e638d498ca4565651cc6", "sha256": "b544a68299ff68d5899d2541da8691dd2a6d4129c9c6d31cd966a0a10062f974" }, "downloads": -1, "filename": "qspypy-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d6c18b225387e638d498ca4565651cc6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 24223, "upload_time": "2018-06-22T19:44:46", "url": "https://files.pythonhosted.org/packages/68/c0/5d4a1267610d0d03fcac41ffb36512eff29e862eedacaf2a209007b09c3f/qspypy-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bbea188f88cb5f68c87308642a64df7d", "sha256": "f7bd7afcb94fd6b1bb55ef955a2d50ed08e45da49897039dcc8dce566ee54b02" }, "downloads": -1, "filename": "qspypy-1.0.tar.gz", "has_sig": false, "md5_digest": "bbea188f88cb5f68c87308642a64df7d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17273, "upload_time": "2018-06-22T19:44:47", "url": "https://files.pythonhosted.org/packages/d4/3f/db24141977934a464e4e227b5690809f69b60ad17c61398a5b1a82196137/qspypy-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "4856bc36ea6ff86651eaa97cc3109fa5", "sha256": "1cd443de3d96de4671d9db6d26f285e28842b4a12f59623e9fc4d914e4cac7c4" }, "downloads": -1, "filename": "qspypy-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4856bc36ea6ff86651eaa97cc3109fa5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 25049, "upload_time": "2018-06-25T19:05:52", "url": "https://files.pythonhosted.org/packages/34/80/daef5dd3284a25114754dce5ab78e55b06c57f79355586b365b1e5544272/qspypy-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "311bb1311ffb4fcb529ef2ba304df122", "sha256": "b6b7a895b669663924348908bd294d8499db28bbea6e6c46428c4c24f369830c" }, "downloads": -1, "filename": "qspypy-1.0.1.tar.gz", "has_sig": false, "md5_digest": "311bb1311ffb4fcb529ef2ba304df122", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18169, "upload_time": "2018-06-25T19:05:53", "url": "https://files.pythonhosted.org/packages/e1/ef/cb203cfefaa838545c4d856a189142296bad48f82e8c384fd8f620f084be/qspypy-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "d43f7e595e3d118b4b1cba8b6d5ce96d", "sha256": "8ba83927c8c0dd778004ee593e8b16e9d565ea9677ed7662e8dd2ff6b7365329" }, "downloads": -1, "filename": "qspypy-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d43f7e595e3d118b4b1cba8b6d5ce96d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29793, "upload_time": "2018-07-09T14:30:17", "url": "https://files.pythonhosted.org/packages/9b/8c/a9dfddec855c531a7c101e0f8fbf69427b85407fcfe259010cf6908afa15/qspypy-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c51db0e0925c91e62384244cae37f903", "sha256": "3c2ae959ccc76198223403311788ada3752b7290adaa5778140f8753b1dc81a2" }, "downloads": -1, "filename": "qspypy-1.1.0.tar.gz", "has_sig": false, "md5_digest": "c51db0e0925c91e62384244cae37f903", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22128, "upload_time": "2018-07-09T14:30:19", "url": "https://files.pythonhosted.org/packages/cc/59/08f709715f964e6d702b47e5d8b22eae5f0aa6ba3df21fc6cfc78f28b22b/qspypy-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d43f7e595e3d118b4b1cba8b6d5ce96d", "sha256": "8ba83927c8c0dd778004ee593e8b16e9d565ea9677ed7662e8dd2ff6b7365329" }, "downloads": -1, "filename": "qspypy-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d43f7e595e3d118b4b1cba8b6d5ce96d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29793, "upload_time": "2018-07-09T14:30:17", "url": "https://files.pythonhosted.org/packages/9b/8c/a9dfddec855c531a7c101e0f8fbf69427b85407fcfe259010cf6908afa15/qspypy-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c51db0e0925c91e62384244cae37f903", "sha256": "3c2ae959ccc76198223403311788ada3752b7290adaa5778140f8753b1dc81a2" }, "downloads": -1, "filename": "qspypy-1.1.0.tar.gz", "has_sig": false, "md5_digest": "c51db0e0925c91e62384244cae37f903", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22128, "upload_time": "2018-07-09T14:30:19", "url": "https://files.pythonhosted.org/packages/cc/59/08f709715f964e6d702b47e5d8b22eae5f0aa6ba3df21fc6cfc78f28b22b/qspypy-1.1.0.tar.gz" } ] }