Commit graph

195 commits

Author SHA1 Message Date
Anders Kaseorg 75d1fe2b41 lint: Upgrade zulint.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg 524d03fc3e deploy: Fix urllib.parse import.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 20:31:14 -07:00
Anders Kaseorg d68437d5f5 Rewrite some strings using raw string syntax.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 15:04:36 -07:00
Anders Kaseorg e30b3b094b Modernize legacy Python 2 syntax with pyupgrade.
Generated by `pyupgrade --py3-plus --keep-percent-format` followed by
manual indentation fixes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-04-18 15:04:36 -07:00
rht c1fb086677 Squash py3_requirements.txt into requirements.txt. 2020-04-03 08:18:08 -04:00
rht 802f85224a Travis: Remove test-py2-legacy-support. 2020-04-03 08:18:08 -04:00
rht 4600ce59a3 Remove all remaining from __future__ imports. 2020-04-03 08:18:08 -04:00
rht 204871b518 Finish the remaining migration of shebang to python3. 2020-04-03 08:18:08 -04:00
rht dea467ccd7 lint: Remove explicit python invocation check. 2020-04-02 07:09:46 -04:00
Kushal Kothari f253819a58
provision: Fix a typo in virtualenv instruction. 2020-03-03 22:39:28 -08:00
Aman Agrawal 32a46cbaa9 mypy: Use Rule from zulint to specify type for custom rules. 2020-01-14 16:00:24 -08:00
Aman 7588333079 lint: Use zulint's methods for lister and printing errors.
Remove lister, printer and README files from server_lib.
2020-01-14 16:00:24 -08:00
Aman Agrawal 101049de27 lint: Add mypy as an external_linter to be run with ./tools/lint.
We were not running `mypy` with `./tools/lint` prior to this.
2020-01-14 16:00:24 -08:00
Aman 7f39201e79 lint: Use zulint as wrapper for running different linters. 2020-01-14 16:00:24 -08:00
Tim Abbott 3bbe972314 tools: Disable python3 shebang lint check for botserver.
Since the botserver can be run directly after installation via pip,
and only supports Python 3, we definitely want the explicit shebang
lines there.

We only don't want this in zulip/, which supports Python 2+3.
2019-03-18 13:58:11 -07:00
Marco Burstein d176fbe324 bots: Fix a Chessbot dependency error.
Specify a version for Chessbot so that it will continue to function
properly if the library is updated. Also, update `test-bots` to remove
a temporary fix for Chessbot.
2018-12-09 18:57:10 -08:00
Steve Howell b4d0a2463e Temporarily exclude chessbot bot from tests. 2018-12-09 11:16:30 -08:00
Zev Benjamin df04e4e1ca Fix tools/provision on OS X.
See the comment for details.
2018-11-29 20:18:28 -08:00
Ujjwal Raizada e769735108 provision: Fix version tuple generation logic.
Previous tuple generation logic was throwing an error parsing version like 3.6.7rc1
because micro-versions (like '7rc1') cannot be converted into an integer.

Fixes #482.
2018-10-31 16:32:56 -07:00
Eeshan Garg 71a15bd89e integrations/trello: Make the zulip_trello script self-contained.
A few users have complained about how hard it is to find the
Trello script on their systems after installing the `zulip`
package. Rishi and I decided that we should instead just ask
the users to download the script directly and run it without
having to install the `zulip` package.

This commit also ensures that the script can be run on both
py2 and py3.
2018-09-25 22:28:25 -02:30
neiljp (Neil Pilgrim) 4e0dccc9f5 test-bots: Make bots_to_test a set, ensuring tests are not duplicated.
The previous style was causing duplicate tests for the dropbox_share bot
for the unittest runner, due to globbing of test_*.py giving duplicates.

However, it also avoids unintentional duplication of bot names to test
on the command line being tested multiple times, though again only with
the unittest runner.
2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) 2895853938 test-main: Pass command-line arguments to each script.
This allows use of:
  -p : Run all tests with pytest
  -v : Additionally run pytest results in verbose mode
2018-06-28 14:55:23 -04:00
neiljp (Neil Pilgrim) de5fa0e8fc test_handler: Add title for test sections which use test_handler. 2018-06-28 14:55:23 -04:00
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