{ "info": { "author": "Jake Cover", "author_email": "python@jakecover.me", "bugtrack_url": null, "classifiers": [ "Topic :: Software Development :: Testing :: Unit" ], "description": "# Distest\n\n[![CodeFactor](https://www.codefactor.io/repository/github/jakecover/distest/badge/?style=flat-square)](https://www.codefactor.io/repository/github/jakecover/distest/overview/?style=flat-square)\n[![Build Status](https://img.shields.io/travis/JakeCover/distest/develop.svg?style=flat-square)](https://travis-ci.org/JakeCover/distest)\n[![PyPi Version](https://img.shields.io/pypi/v/distest.svg?style=flat-square\n)](https://pypi.org/project/distest)\n\n\n\nA small library used to write automated test for Discord bots.\n\nTest framework originally written by [DXsmiley](https://github.com/DXsmiley), update to the rewrite and re-worked UI done by [me](https://github.com/JakeCover), with tons of help from [ALobsterDog](https://github.com/ALobsterDog)\n\nJust about ready for a 1.0, just need to add a few more features. Until I get everything to a 1.0 though, expect the command line arguments and everything else to be volatile. In addition to the example here, my [main bot](https://github.com/JakeCover/ReplyBot) will be implementing this soon.\n\n## Installation\n\nBest way to get this running is to `git clone` it. The example bot's usage can be seen below.\n\n## Usage\n\n#### General\nIn order to use this package, you'll have to create *two* bot accounts. The first, referred to as the *target*, is the bot that you wish to test. If you're already here you probably have a token for this bot already. The second one, called the *tester* is responsible for running the tests.\n\nThe most important thing to know about this bot is that it has two modes, interactive and CLI. **Interactive mode** is used if you want to manually run the tests from inside discord. I also use it when testing the new tests. **CLI mode** allows you to start the bot and run the tests without any interaction, which is the mode that you will probably want to use when using this package in most cases. More information on how these two modes are used is available further down the readme.\n\nFirst, you need to run the bot that you wish to test. You can run the example bot supplied with this repo as follows:\n```\npython example_bot.py TARGET_TOKEN\n```\n\nThen, you have to run the tester bot (This will run it in interactive mode - CLI mode demo shown later):\n```\npython example_tester.py TARGET_USERNAME TESTER_TOKEN\n```\n\nMake sure to use the username of the bot **without** the discriminator (#1111) or the bot won't understand what the user is\n\nOnce both bots are running, go to any discord channel that both bots have access to and type `::run all` to run all the tests. Use `::help` to get more information on the commands that the tester can use in interactive mode.\n\n#### Making your own tester Bot\nStart by writing functions to do the tests, examples can be seen in the example tester. Decorate the functions you want to be run as tests with `@distest.TestCollector()` and they will be available to be run. Instead of calling `run_bot()` like you would normally do to start a bot with discord.py, use `distest.run_dtest_bot()` and feed in the requested parameters. Based on the sysargs that are used to run the bot file, it will automatically run the bot in interactive or CLI mode. Basically, if you feed the bot the `-c` parameter to specify the channel that the tests should be run in, the bot will run those automatically. Otherwise, it will wait for the commands in discord as described below. \n\n### CLI Mode\nCLI mode is designed to be used to run the tests in a normal way, such as on git hooks or a CI/CD pipeline. The following text is the usage snippet from the help command followed by some more general information from me. It isn't the same as the help message, as I tried to make it more in-depth. \n\n usage: example_tester.py [-h] [-c channel]\n [--run {all,test_reply_matches} | --stats]\n target_bot_user tester_bot_token\n \n\n**Always Required**\n\n- `target_bot_user`: The username (no discriminator) of the target bot. Same as described above in the general section.\n\n- `tester_bot_token`: The token that will be used to run the tester bot. Also the same as described above in general.\n\n**CLI Mode**\n\n- `run`: Specifies if you will run all tests or a subset of them\n\n- `stats`: Runs the bot in stats mode. Mutually exclusive with `run`. (Not very useful, may be removed. If you use it in some way, open an issue and let me know!)\n\n- `channel`: The channel ID that the tests will be conducted in. Just need the int ID\n\n**Other**\n\n- `-h`: Just shows the help command. This is only the usage message, there is other information in the help.\n\n**Sample Command**\n\nThe command I used to test this bot is available in run_tester.sh\n\n\n### Interactive Mode Commands\nCommands you can run in discord once the bot is running in interactive mode.\n\n ::stats\n Gives details about which tests have been\n run and what the results were\n\n ::run test_name\n Run a particular test. Options are methods decorated \n with `@distest.TestCollector()` in the tester bot.\n\n ::run all\n Run all tests\n\n ::run unrun\n Run all tests that have not yet been run\n\n ::run failed\n Run all tests that failed on the most recent run\n\n\n## Contributing\nPlease open an issue for your contribution and tag it with contribution to discuss it. I recommend waiting for a response before pouring hours and hours into the contribution, but it will likely be approved either way. The other thing is to make sure you check the github project to see if there is someone else already working on it who you can help. Other notes:\n\n* If you are adding new test types, please make sure you test them well to make sure they work as intended, and please add a demo of them in use to the `example_tests()` for others to see. When you are done, please open a PR and I'll add it in!\n\n* I use Black for my code formatting, it would be appreciated if you could use it when contributing as well. I will remind you when you make a PR if you don't, it is essential to make sure that diffs aren't cluttered up with silly formatting changes. Additionally, CodeFactor *should* be tracking code quality and doing something with PRs. We will see soon exactly how that will work out.\n\n* Make sure that your issue goes onto the project, that's how we keep track of to-do and in progress things.\n\n* Also, if you just want to propose an idea, create an issue and tag it with enhancement. Thank you for your help!\n\n\n\n\n## TODO\n\nI used to use this, now using the GitHib project instead. This will no longer be used.\n\n- [x] Update the Bot to the newly re-written discord.py 1.0\n- [ ] Verify each test and add to `example_tests.py`\n - [ ] send_message\n - [ ] edit_message\n - [ ] wait_for_reaction\n - [ ] wait_for_message\n - [ ] wait_for_reply\n - [ ] assert_message_equals\n - [x] assert_message_contains\n - [ ] assert_message_matches\n - [x] assert_reply_equals\n - [x] assert_reply_contains\n - [x] assert_reply_matches\n - [x] assert_reaction_equals\n - [x] ensure_silence\n - [x] ask_human\n- [x] Allow running tests from the command line\n - [x] Add CLI mode section to the readme\n - [x] Have the bot return exit codes depending on test status\n- [ ] More test types\n- [ ] Prep for pip, get it packaged", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/JakeCover/distest", "keywords": "Discord,Discord.py,Unit Test,Test,Distest,Discord Testing", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "distest", "package_url": "https://pypi.org/project/distest/", "platform": "", "project_url": "https://pypi.org/project/distest/", "project_urls": { "Homepage": "http://github.com/JakeCover/distest" }, "release_url": "https://pypi.org/project/distest/0.3.1/", "requires_dist": null, "requires_python": "", "summary": "Automate the testing of discord bots... With discord bots!", "version": "0.3.1" }, "last_serial": 5334291, "releases": { "0.1.0.dev0": [ { "comment_text": "", "digests": { "md5": "646e8fcea1e597e3a1eb134503c6eb80", "sha256": "a5c5a5803972fc070d699e355044a20676eaf04f636db32bb5eac35baebd28d3" }, "downloads": -1, "filename": "distest-0.1.0.dev0-py3-none-any.whl", "has_sig": false, "md5_digest": "646e8fcea1e597e3a1eb134503c6eb80", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8569, "upload_time": "2019-05-16T00:49:36", "url": "https://files.pythonhosted.org/packages/e2/9d/3d2055f3a5f3cf29d2fec712df20c75601703f5922220fe068594409e3fa/distest-0.1.0.dev0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "046168d34711c1f90d84fa4e7796b833", "sha256": "bfb3901078eddc9c28bed2e6d4e39905deeb0139f08be1fb6278e858b4f06796" }, "downloads": -1, "filename": "distest-0.1.0.dev0.tar.gz", "has_sig": false, "md5_digest": "046168d34711c1f90d84fa4e7796b833", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7410, "upload_time": "2019-05-16T00:49:40", "url": "https://files.pythonhosted.org/packages/a8/7b/3c7b900776c42f1a795fdbafaa7e306fba588399368cd9e9ab939cb8d756/distest-0.1.0.dev0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "38313b11213488feb5fdadfe2542e2fc", "sha256": "6f68cf589751004e3600dacbba905c9d290938fabe04a5bc5ae72188c37d71f0" }, "downloads": -1, "filename": "distest-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "38313b11213488feb5fdadfe2542e2fc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11274, "upload_time": "2019-05-16T00:49:38", "url": "https://files.pythonhosted.org/packages/a8/d7/0637d2e16e42b9d7aa60704b326f40aa9a13fce5afc265a221f0604314f6/distest-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5d5705c583574c15776b07517206c83c", "sha256": "c2a44f1f3089f82abcdcb6c2d97873f5505674156d613d38a7d540943f94938e" }, "downloads": -1, "filename": "distest-0.2.0.tar.gz", "has_sig": false, "md5_digest": "5d5705c583574c15776b07517206c83c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12218, "upload_time": "2019-05-16T00:49:41", "url": "https://files.pythonhosted.org/packages/34/05/9dee938c08ccb241069aed0b2b6a81c293904262078fec431fe970587ece/distest-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "cf547bc93eefb4f6cc1dba290f46e792", "sha256": "1b07bf1b35b38236912f946316d562fd814b3b8b5f511cd40eee248f0abe8010" }, "downloads": -1, "filename": "distest-0.3.0.tar.gz", "has_sig": false, "md5_digest": "cf547bc93eefb4f6cc1dba290f46e792", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13891, "upload_time": "2019-05-28T20:40:30", "url": "https://files.pythonhosted.org/packages/e8/cb/731975b216ddcaf46df277cd57e8df5520302d9d60b736e17e7ea08c1d64/distest-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "d9970335992ef109e632a641dfb8ceb2", "sha256": "2cee898b8157b2458d6e9ea7f1fa01895a0c1b4126ef1b65673d7ce8f2c33d6f" }, "downloads": -1, "filename": "distest-0.3.1.tar.gz", "has_sig": false, "md5_digest": "d9970335992ef109e632a641dfb8ceb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13959, "upload_time": "2019-05-29T20:33:16", "url": "https://files.pythonhosted.org/packages/90/55/f1bae0775d6afbd04a3db65598cc862a47bf1d1a0c26ad3b180b32b48762/distest-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d9970335992ef109e632a641dfb8ceb2", "sha256": "2cee898b8157b2458d6e9ea7f1fa01895a0c1b4126ef1b65673d7ce8f2c33d6f" }, "downloads": -1, "filename": "distest-0.3.1.tar.gz", "has_sig": false, "md5_digest": "d9970335992ef109e632a641dfb8ceb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13959, "upload_time": "2019-05-29T20:33:16", "url": "https://files.pythonhosted.org/packages/90/55/f1bae0775d6afbd04a3db65598cc862a47bf1d1a0c26ad3b180b32b48762/distest-0.3.1.tar.gz" } ] }