Commit graph

172 commits

Author SHA1 Message Date
neiljp (Neil Pilgrim) 2fd9162030 test-lib: Drastically simplify by using test_handler function.
This automatically enables use of the pytest runner using common code.
2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) 52ab8cc44e test_handler: Separate test title from path to discover tests. 2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) a6a5da2653 test_handler: Support running various tests using pytest.
This enables use of pytest with:
* the zulip package
* the botserver package
2018-06-28 14:55:23 -04:00
Rhea Parekh 7e8deac8e0 bots: Add type annotations for trivia_quiz bot. 2018-06-11 20:01:41 -04:00
neiljp (Neil Pilgrim) d73fa0f50f test-bots: Add option to use pytest for running tests.
* Add pytest to requirements.txt
* Add pass-through option to run pytest in verbose mode
* Use various default pytest options
* Exclude merels bot for now
2018-06-09 14:13:18 -04:00
neiljp (Neil Pilgrim) 69fab99ba7 linter: Add check for incorrect use of inheritance in Bot test cases. 2018-06-09 12:49:49 -04:00
neiljp (Neil Pilgrim) 6cdb83ce72 bot tests: Adjust TestCase inheritance to avoid need to skip/filter.
Previously the test-bots script filtered out base-class tests from
BotTestCase. With this change, BotTestCase continues to inherit from
unittest.TestCase, but the default test_* methods previously in this
class are now in a new DefaultTests class, which does not. Instead, each
bot needs to inherit from BotTestCase and DefaultTests *explicitly*.

This avoids the need to filter out the base-class tests, which
simplifies the test-bots script, and may ease any migration to eg.
pytest.

The DefaultTests class does require some non-implemented methods which
BotTestCase provides.
2018-06-09 12:49:49 -04:00
Eeshan Garg e7e9059cb8 zulip_bots: Move installation of bot deps to tools/provision.
A lot of these bot dependencies are pretty hefty and shouldn't be
installed as part of the zulip_bots package. So the installation of
these belongs in tools/provision, not in setup.py.
2018-06-04 20:01:53 -02:30
neiljp (Neil Pilgrim) 4c8d86c1d9 bot lib tests: Move tests of bot library to tests/.
This makes it clearer which files are for writing bot tests
vs tests of the infrastructure.
2018-05-30 18:29:47 -07:00
Tim Abbott d14a025ff9 provision: Make the source line stand out more. 2018-05-29 11:32:45 -07:00
Robert Hönig 8e653fe064 linter: Add rule to favor Botserver over botserver or bot server. 2018-05-29 10:59:15 +02:00
Robert Hönig a8045a8fa9 mypy: Fix paths to chessbot files. 2018-05-28 13:43:15 +02:00
neiljp (Neil Pilgrim) a178f93087 test-bots: Detect absent __init__.py & optionally exit. 2018-05-26 17:28:25 -07:00
neiljp (Neil Pilgrim) bda678344f test-bots: Extract common filter out of conditional. 2018-05-26 17:28:25 -07:00
neiljp (Neil Pilgrim) 210caa4a60 test-bots: Extract test discovery out of conditional.
This (re?)-enables exclusion of bot names from eg. `test-bots`.
2018-05-26 17:22:03 -07:00
neiljp (Neil Pilgrim) a5307b3771 test-bots: Use unused available_bots to discover tests. 2018-05-26 17:22:03 -07:00
neiljp (Neil Pilgrim) 76b2befb9b test-bots: Remove unused function parameter. 2018-05-26 17:22:03 -07:00
neiljp (Neil Pilgrim) 1d60794f1c test-bots: Simplify and unify test discovery. 2018-05-26 17:21:54 -07:00
dkvasov b119d67182 tools/provision: Use python3 because python2 doesn't work. 2018-05-16 10:50:43 -07:00
Rohitt Vashishtha a4b32a4dc8 tools/deploy: Read $SERVER and $TOKEN environment variables.
This simplifies the usage of the script by eliminating the need to
pass --server=$SERVER and --token=$TOKEN in each call to the script.

Also renames key=>token for consistency.
2018-05-07 12:31:53 +05:30
novokrest bf9ad09bc2 deploy: Support new JSON-formatted responses from Botfarm. 2018-05-07 10:29:09 +05:30
Novokreshchenov Konstantin dcd4c4a96e deploy: Add tools/deploy ls command.
Displays bot's name, status, email and site. Add `--format` to
pretty-print the list of bots.
2018-05-03 03:34:00 +05:30
novokrest 42c474d273 deploy: Add tools/deploy delete command. 2018-05-02 23:27:43 +05:30
Anupam-dagar 345666ca58 tools/deploy: Add command to receive logs for the specified bot. 2018-04-20 04:57:39 +05:30
neiljp (Neil Pilgrim) 7dc0703397 tools: Move strict-optional to mypy.ini & remove option from run-mypy. 2018-04-06 13:45:11 -04:00
neiljp (Neil Pilgrim) 6cbe1f5ba7 tools: Migrate core run-mypy options to mypy.ini.
Add traceback option, as used in core Zulip run-mypy.
2018-04-06 13:45:11 -04:00
Rohitt Vashishtha e49ecfcd39 mypy: Support files without extensions for scripts in /tools.
This assumes that files passed in force_include without any extension are meant
to be run with mypy, and thus assumed to be python scripts.

Also, we ignore the most of the tools dir, except for the tools/deploy script
for which #349 adds type annotations.
2018-03-30 07:54:10 -04:00
Shivam Gera 401674016c mypy: Annotate tools/deploy using mypy 2018-03-25 18:03:03 -04:00
Rohitt Vashishtha 0efc7a9488 tools/deploy: Add script to deploy bots on a remote bot server.
This script interfaces with a Zulip Botfarm - a flask server that wraps
docker and runs Zulip bots using the docker engine. This allows for
remotely hosting bots for better uptime, and reduces the configuration
steps needed for safely hosting a bot online.
2018-03-09 06:49:19 -05:00
Alena Volkova ea8393511a interactive bots: Create Front bot. 2018-03-08 07:38:35 -05:00
amanagr 5fda59dde0 Susi AI Bot: Create a susi ai bot.
This bot uses SUSI_SERVER API to get response.
2018-02-22 09:36:25 -05:00
Viraat Chandra b7b083f094 interactive bots: Add Trello Interactive Bot. 2018-02-16 09:54:55 -05:00
fredfishgames 3a438cafa9 zulip_bots: Migrate connect_four bot to new game_handler. 2018-01-22 11:30:31 -05:00
Steve Howell 25820c9bb2 provision: Do not even suggest the --force option.
Suggesting to users that they use '--force' during provision
is just asking for trouble.  We will probably want to deprecate
that altogether soon.
2018-01-19 07:50:40 -05:00
Eeshan Garg e528577f11 tools/release-packages: Generate Python3 dist for zulip_bots.
Now that zulip_bots is fully Python3, it makes sense to only
generate a Python3 wheel dist for it. zulip and zulip_botserver
are still distributed as a py2/py3 universal wheel.
2018-01-08 21:17:28 -03:30
Eeshan Garg 072d43b7c3 tools/release_packages: Stop generating sdists.
Now that we do not use MANIFEST.in for zulip_bots, it doesn't
make sense to distribute sdists, because sdists don't pick up
data files specified in the package_data argument to setup().

Also, it isn't a huge deal if we don't distribute sdists for our
packages. Most PyPI projects only release wheels and pip will also
use wheels if available. So, this made sense!
2018-01-08 21:17:28 -03:30
Eeshan Garg e20b754498 zulip_bots: Use package_data instead of MANIFEST.in.
This commit removes generate_manifest.py and package data files
are now included using the package_data kwarg to setup().

This is because, in certain situations, MANIFEST.in is a bit
finicky. For instance installing a package using:

python setup.py install

doesn't include files specified in MANIFEST.in, while using

pip install ./zulip_bots

does. package_data doesn't pose this problem, ergo it's better
for us.
2018-01-08 18:28:50 -03:30
neiljp (Neil Pilgrim) 2366b22405 Tools: Update tools/run-mypy to default to strict-optional. 2018-01-08 15:39:03 -05:00
Xavier Cooney 1de704394a interactive bots: Create idonethis bot. 2018-01-08 10:46:52 +01:00
fredfishgames 08bfe9d8c7 interactive bots: Create Salesforce bot. 2018-01-02 14:00:41 -05:00
Steve Howell 41b065eb76 tools: Fix python -> python3 for bots scripts.
This also turns off the custom lint check that was
preventing an explicit version for scripts in "tools".

Fixes #187
2018-01-02 17:38:12 +01:00
Steve Howell 19c3792af5 tools/provision: Exit earlier for python2.
We really want to avoid confusing folks that just want
to work on bots in python3.
2018-01-02 17:38:12 +01:00
Viraat Chandra d62cc1ab58 update run-mypy: Add Baremetrics bot files. 2017-12-31 10:23:43 -05:00
Viraat Chandra a2557ccbe6 interactive bots: Create Mention bot. 2017-12-28 16:33:00 -05:00
Rhea Parekh 0bb50fdc4e slack importer: Shift the slack data conversion files to zulip server repo. 2017-12-27 07:54:42 -05:00
Robert Hönig 1599839956 Make git utility scripts executable. 2017-12-27 10:55:38 +01:00
neiljp (Neil Pilgrim) 134b94e630 requirements: Upgrade to mypy 0.560 & adjust generics flag.
This upgrades to the same mypy as zulip/zulip at this point.
2017-12-21 18:43:42 -05:00
Eeshan Garg 0e8a40b7c0 tools/release-packages: Document the release process.
This commit updates the command usage string to also document
the release process briefly.
2017-12-18 23:07:42 -03:30
Eeshan Garg 4dfa2d6f33 tools/release-packages: Add update-main-repo subcommand.
The ability to update the zulip/requirements/* files in the main
zulip repo has now been made a part of its own subcommand.

To update the requirements to install the packages off of the
0.4.0 tag, run:

./release-packages ZULIP_DIR_PATH 0.4.0

To update the requirements to install the packages off of the
commit hash abcdefg, but the version to be 0.4.0, run:

./release-packages ZULIP_DIR_PATh 0.4.0 --hash abcdefg
2017-12-18 22:47:42 -03:30
Eeshan Garg 3c23dd6c66 tools/release-packages: Remove the ability to push changes.
This commit removes the following:

* This script's dependency on gitpython, it is not maintained actively.
* The ability to push changes in this and the main zulip/ repo. Doing
  so automatically was turning out to be cumbersome and buggy and
  doing it manually doesn't take significantly longer anyway.
* The ability to automatically increment PROVISION_VERSION in
  zulip/version.py. Again, this was too buggy and it doesn't take
  much longer to just increment it by hand.

Removing the above features made the script a lot easier to maintain
and read.
2017-12-18 22:05:54 -03:30