Umair Khan
938291a922
Add run-dev.py test to Travis CI test suites.
...
Fixes #919
2016-06-08 14:10:37 +05:00
Vishnu Ks
d30ea0bc44
Move recent_subjects to stream_data.
2016-06-07 17:50:16 -07:00
Tim Abbott
be53c9e39e
tests: Check for presence of typing in venv guard.
...
Since relatively few systems have the typing module, this makes the
checks for whether the user is properly running our test scripts in
the virtualenv more likely to trigger well.
2016-06-06 13:41:34 -07:00
Ernesto Vargas
ffb2f9e84b
lint/tests: Give nice error message for common import failures.
...
This should make users much more likely to be able to debug issues
where they ran Zulip outside the Vagrant environment or virtualenv.
[error messages tweaked by tabbott]
2016-06-06 13:39:26 -07:00
Tim Abbott
553ef81f92
Add lint rules for mypy type annotations.
2016-06-05 13:00:55 -07:00
James Porter
2a8e8129d1
Make emoji_dump delete old ttx files on start.
2016-06-04 17:05:48 -07:00
James Porter
f5f2d72178
Wrap main bit of emoji_dump.py in a main function.
2016-06-04 17:05:48 -07:00
James Porter
9d58624359
Minor reformatting of emoji_dump.py.
2016-06-04 17:05:48 -07:00
James Porter
d008d96597
Update Emoji set.
2016-06-04 17:05:48 -07:00
Reid Barton
0b7852f081
Generate mypy coverage report for travis + coveralls.
2016-06-04 13:01:19 -07:00
Tim Abbott
03debdf82f
Fix malformed error message when creating invalid Realm Emoji.
...
Thanks to Greg McCoy for his help finding this bug.
2016-06-03 23:12:36 -07:00
Tim Abbott
e7d9b28dfc
install-mypy: Pass --upgrade to correctly handle new mypy versions.
2016-06-03 19:11:32 -07:00
Tim Abbott
5d5f1f46dc
Upgrade mypy and typed_ast to latest versions.
2016-06-03 18:59:55 -07:00
Nathan Florea
5fe9076631
Remove some mutable default arguments.
...
These ones don't fix any bugs, because the mutable arg is never passed
outside of the callable or mutated. But it's good practice to not use
them in case those invariants are changed in the future.
2016-06-03 09:16:56 -07:00
Tim Abbott
37015fd7c5
Run mypy on zerver/lib/test_auth_backends.py.
2016-06-02 23:01:15 -07:00
Tim Abbott
8cef9675c8
Run mypy on zerver/lib/test_events.py.
2016-06-02 23:00:04 -07:00
Tim Abbott
e6d2b0cdbc
Run mypy on zerver/lib/test_unread.py.
2016-06-02 22:59:00 -07:00
Tim Abbott
f3b07ee9aa
Run mypy on zerver/lib/test_subs.py.
2016-06-02 22:57:07 -07:00
Tim Abbott
1bdbdd1110
Run mypy on test files where it already passes.
2016-06-02 22:53:28 -07:00
Umair Khan
072551a94e
Fix most redownloading in 'vagrant reload --provision'.
...
Fixes #264 .
2016-06-02 22:32:56 -07:00
Conrad Dean
f8f2f45410
run-mypy: Add --linecount-report and --disallow-untyped-defs flags.
2016-06-02 18:45:52 -07:00
Tim Abbott
fbc30c2914
test-all: Add a call to run-mypy.
...
Using mypy to check the codebase is stable and useful enough that it's
worth including it in the default tests run locally.
2016-05-31 15:00:15 -07:00
Umair Khan
bd4e471706
Check json_error and JsonableError in linter.
...
Mainly the check is to ensure that all the strings that pass through
these two functions are captured by `makemessages`.
2016-05-31 07:40:42 -07:00
Umair Khan
4b28fcd2f3
Add option to linter to exclude lines from files.
2016-05-31 07:40:42 -07:00
Tim Abbott
41336f3782
lint-all: Check for use of '== None'.
2016-05-31 07:02:04 -07:00
Umair Khan
c884559ec6
Show templates rendered report.
...
Add two options to the `test-backend` script:
1. verbose
If given the `test-backend` script will give detailed output.
2. no-shallow
Default value is False. If given the `test-backend` script will
fail if it finds a template which is shallow tested.
2016-05-31 16:46:11 +05:00
Greg Price
436499a129
Clean up some relative-path handling in lister using Git magic
...
This lets us cut out the line which hard-codes how deeply nested in
the tree the `run-mypy` script is, making it simpler to borrow these
scripts in other projects.
2016-05-30 20:01:37 -07:00
Reid Barton
8c6afac7cd
Add a stub file for request.py.
...
This stub file allows us to annotate view functions using the actual
types present in the bodies of the functions, rather than everything
having the type REQ.
2016-05-30 11:28:53 -07:00
Reid Barton
ff845ebb96
Make tools/install-mypy exit on error.
2016-05-30 09:49:45 -07:00
Eklavya Sharma
149938d468
Change shebangs from python2.7 to python.
2016-05-29 05:03:08 -07:00
Vishnu Ks
fea5ed5b60
Remove unread_subjects from check-all.js
...
unread_subjects is not used by other modules.
2016-05-27 01:03:21 -07:00
Vishnu Ks
51c86a8e2e
Move get_private_message_recipient to message_store.js
2016-05-27 01:03:21 -07:00
Vishnu Ks
89d743787e
Move recenter_view to viewport.js.
2016-05-27 01:03:21 -07:00
Vishnu Ks
4be20c4b4a
Move scroll_to_selected to navigate.js.
2016-05-27 01:03:21 -07:00
Vishnu Ks
e329c9e0f5
Move maybe_scroll_to_selected to navigate.js.
2016-05-27 01:03:21 -07:00
Vishnu Ks
dc577343fe
Move last_viewport_movement_direction to viewport.
2016-05-27 01:03:21 -07:00
Umair Khan
0278ce9102
Move tools/py3_test_reqs.txt to tools/setup/.
...
Fixes #708
2016-05-26 18:43:24 +05:00
Umair Khan
57f477dd8b
Move tools/install-phantomjs to tools/setup/.
2016-05-26 18:28:14 +05:00
Umair Khan
1161862b07
Move tools/emoji_dump to tools/setup/.
2016-05-26 18:28:14 +05:00
Umair Khan
b85526576a
Move tools/postgres-init-dev-db to tools/setup/.
2016-05-26 18:28:10 +05:00
Umair Khan
b0991966ab
Move tools/postgres-init-test-db to tools/setup/.
2016-05-26 18:28:05 +05:00
Umair Khan
d425e05a02
Move tools/generate-fixtures to tools/setup/.
2016-05-26 17:54:32 +05:00
Umair Khan
8335bd672f
Move tools/generate-test-credentials to tools/setup/.
2016-05-26 17:54:28 +05:00
Umair Khan
d5f3a82284
Move tools/download-zxcvbn to tools/setup.
2016-05-26 16:05:23 +05:00
Eklavya Sharma
09400a7e50
End compile-handlebars-templates gracefully.
...
Catch KeyboardInterrupt from tools/compile-handlebars-templates,
print a message and exit when running in forever mode.
2016-05-25 16:06:35 -07:00
Eklavya Sharma
d9c4be87d1
Make docs/conf.py pass mypy check.
2016-05-25 15:04:39 -07:00
Eklavya Sharma
30892b2f99
Make makemessages.py pass mypy check.
2016-05-25 15:04:39 -07:00
Eklavya Sharma
ea52fc05ed
Make zproject/urls.py pass mypy check.
2016-05-25 15:04:39 -07:00
Eklavya Sharma
1c04560def
Re-enable pyflakes in linter and remove python 3 pyflakes errors.
2016-05-25 19:25:13 +05:30
Eklavya Sharma
1a6257394c
Make tools/lint-all run on python 3.
...
Since pyflakes catches some extra errors in python 3, disable
pyflakes for now.
2016-05-25 19:23:13 +05:30
Eklavya Sharma
3185b7e750
Remove unneeded imports from tools/lint-all.
2016-05-25 19:12:09 +05:30
Eklavya Sharma
c800c87d2d
Remove __pycache__ in tools/clean-repo.
2016-05-24 13:43:49 -07:00
Eklavya Sharma
b210727e5c
Enable running tools/run-mypy on a subdirectory.
...
Previously tools/run-mypy could not run on a subdirectory properly
because run-mypy assumed exclude files to be in that subdirectory.
2016-05-24 13:24:15 -07:00
Eklavya Sharma
bd63caed96
Fix exclude startegy in tools/lister.py.
...
Previously lister.py used to check whether the exclude path is a
substring of a path being considered. So it would fail when the
exclude path is an absolute path or uses '..' or '.'.
2016-05-24 13:24:15 -07:00
Eklavya Sharma
f3e25c68c7
Prevent tools/travis/mypy from failing silently.
...
Also improve the format of tools/travis/mypy's output.
Also add those files to the exclude list which are failing mypy check.
2016-05-21 12:37:04 +05:30
Umair Khan
82b5d9304b
[third] Integrate i18next with Handlebars
2016-05-19 22:58:25 -07:00
Tim Abbott
cadbe64265
Fix venv files being included in coverage reports in CI.
...
e4707af2e2
didn't correctly deal with
the different path for the venv cache in Travis CI.
2016-05-19 10:25:56 -07:00
Tim Abbott
e4707af2e2
test-backend: Fix venv files being included in coverage reports.
2016-05-19 09:36:53 -07:00
Umair Khan
e56d3196ef
Update provisioning/release scripts to build `.mo` files.
...
We need to update provision.py to compile the messages files, since
they are needed for the new i18n tests. And of course we need to
include the .mo files in release tarballs; there's a bit of complexity
there around how the tarball archives are created.
2016-05-18 19:30:00 -07:00
Umair Khan
e6d33e8834
jslint: Fix typo.
2016-05-18 18:58:06 -07:00
Eklavya Sharma
016a2faa23
Make zproject/local_settings.py pass mypy check.
2016-05-18 17:10:18 +05:30
Eklavya Sharma
54759be785
Make zproject/local_settings_template.py pass mypy check.
2016-05-18 17:10:18 +05:30
Eklavya Sharma
70a94a5b23
Expand zproject/ in mypy exclude list.
2016-05-18 17:10:18 +05:30
Eklavya Sharma
6606c30355
Remove zilencer/models.py from mypy exclude list.
...
zilencer/models.py no longer gives an error on type checking with
mypy.
2016-05-18 17:10:18 +05:30
Eklavya Sharma
7c77522ce4
Make zerver/middleware.py pass mypy check.
...
This was done by reporting python/mypy#1540 and upgrading to the
latest version of mypy which has the fix for this.
2016-05-18 17:10:18 +05:30
Eklavya Sharma
98afe000ee
Make zerver/lib/statistics.py pass mypy check.
2016-05-18 17:10:18 +05:30
Eklavya Sharma
0dcd8b387d
Make zerver/lib/bugdown/fenced_code.py pass mypy check.
2016-05-18 17:10:17 +05:30
Eklavya Sharma
3441f0848c
Annotate pg_backup_and_purge.py.
2016-05-18 17:10:17 +05:30
Eklavya Sharma
66bb6394e5
Make api/zulip/__init__.py pass mypy check.
2016-05-18 17:10:17 +05:30
Eklavya Sharma
46757f07bf
Make zerver/lib/actions.py pass mypy check.
2016-05-18 17:10:17 +05:30
Eklavya Sharma
16067b7013
Make zerver/views/webhooks/jira.py pass mypy check.
2016-05-18 17:10:17 +05:30
Tim Abbott
12b32d3889
check-py3: Display git status --porcelain output.
2016-05-12 16:30:58 -07:00
Tim Abbott
6c744564a7
travis: Add debugging code for rabbitmq nagios failures.
2016-05-09 09:55:18 -07:00
Umair Khan
5359e6b0d4
Convert Zulip to use Jinja2 templates.
...
This results in a substantial performance improvement for all of
Zulip's backend templates.
Changes in templates:
- Change `block.super` to `super()`.
- Remove `load` tag because Jinja2 doesn't support it.
- Use `minified_js()|safe` instead of `{% minified_js %}`.
- Use `compressed_css()|safe` instead of `{% compressed_css %}`.
- `forloop.first` -> `loop.first`.
- Use `{{ csrf_input }}` instead of `{% csrf_token %}`.
- Use `{# ... #}` instead of `{% comment %}`.
- Use `url()` instead of `{% url %}`.
- Use `_()` instead of `{% trans %}` because in Jinja `trans` is a block tag.
- Use `{% trans %}` instead of `{% blocktrans %}`.
- Use `{% raw %}` instead of `{% verbatim %}`.
Changes in tools:
- Check for `trans` block in `check-templates` instead of `blocktrans`
Changes in backend:
- Create custom `render_to_response` function which takes `request` objects
instead of `RequestContext` object. There are two reasons to do this:
1. `RequestContext` is not compatible with Jinja2
2. `RequestContext` in `render_to_response` is deprecated.
- Add Jinja2 related support files in zproject/jinja2 directory. It
includes a custom backend and a template renderer, compressors for js
and css and Jinja2 environment handler.
- Enable `slugify` and `pluralize` filters in Jinja2 environment.
Fixes #620 .
2016-05-09 09:55:18 -07:00
Tim Abbott
804dad42e6
travis: Run various Nagios checks in production tests.
2016-05-08 17:35:50 -07:00
Tim Abbott
744e8ad0e3
travis: Set prod EXTERNAL_HOST to resolve correctly.
...
This is needed to use check_send_receive_time in the tests.
2016-05-08 17:35:50 -07:00
Tim Abbott
e4c098fba4
travis: Verify all supervisord jobs are running in production test.
...
This requires a bit of complexity since supervisord automatically
restarts failing jobs.
2016-05-08 17:35:50 -07:00
Tim Abbott
40de75d9e6
travis: Verify the server doesn't 500 in production test.
2016-05-08 17:35:50 -07:00
Vladislav Manchev
52e96915e2
check-templates: Allow HTML tag brackets inside tag attributes.
2016-05-08 16:33:03 -07:00
Tim Abbott
6e1872987d
Move bin/get-django-setting to scripts/.
2016-05-07 19:37:06 -07:00
Tim Abbott
c1a680e2a9
rate_limiter: Fix misplaced type annotation and cleanup code.
...
You don't put type annotations on return values.
2016-05-06 13:38:12 -07:00
Tim Abbott
3a0e7c217f
mypy: Move verbose error output to travis CI wrapper.
...
This makes it easier to pipe the output of tools/run-mypy to tools
like grep.
2016-05-06 13:38:12 -07:00
Tim Abbott
b21454d05e
mypy: Use the new --fast-parser option.
...
This makes mypy about 15% faster running on the Zulip codebase (from
7s=>6s on my laptop), which seems worth it for losing a couple files.
This option requires a new dependency, which we add to the
mypy-specific requirements.txt file.
2016-05-06 13:38:12 -07:00
Tim Abbott
1807e855e7
Upgrade mypy to the new 0.4.0 release.
...
Also update the mypy command line to not use deprecated argument names.
This introduces a few errors, so we exclude the relevant files to keep
the mypy output clean.
2016-05-06 13:38:12 -07:00
Tim Abbott
542af0d6b6
lint: Add option to print verbose timing output.
2016-05-04 14:22:52 -07:00
Tim Abbott
e2aeee0c35
lint: Add check for unnecessary whitespace between % and (.
2016-05-04 14:22:52 -07:00
Tim Abbott
72ee9f5137
lint: Check for unnecssary whitespace after ','s.
2016-05-04 14:17:27 -07:00
Tim Abbott
dd40f51fee
Add code to clean the venv cache of old venvs.
2016-05-03 15:04:03 -07:00
Tim Abbott
9970341ede
Fix caching of install-phantomjs library in Travis CI.
2016-05-03 14:48:21 -07:00
Tim Abbott
391a225595
lint: Check for missing space after comments.
2016-05-02 22:10:47 -07:00
Tim Abbott
762a3188ee
Fix missing whitespace after # in comments.
2016-05-02 22:10:47 -07:00
Tim Abbott
52c1e8ac7d
Run a local camo server in voyager production environments.
...
Camo is a caching image proxy, used in Zulip to avoid mixed-content
warnings by proxying HTTP image content over HTTPS. We've been using
it in zulip.com production for years; this change makes it available
in standalone Zulip deployments.
2016-05-02 17:21:31 -07:00
Tim Abbott
48a578d003
travis: hold expensive to upgrade packages in Travis CI.
...
This should save a few minutes of time running the production test
suite. This is part of solving #722 .
2016-05-02 16:59:21 -07:00
Tim Abbott
79327a61ae
travis: Do an apt-get update before the apt upgrade.
...
This should save several minutes off the Travis CI `production`
suite's runtime, since previously we were doing the full apt upgrade
process twice, resulting in things like multiple expensive rebuilds of
the initramfs.
2016-05-02 16:35:46 -07:00
Eklavya Sharma
27f12b2de3
Annotate tools/lister.py.
2016-05-01 23:04:09 +05:30
Eklavya Sharma
247cdf578b
Add dependencies to setup-py3k.
...
Add 'six' to setup-py3k, because it is being used in tools/lister.py.
Add 'typing' to setup-py3k, so that tools/lister.py can be type
annotated in the future.
2016-05-01 10:47:04 +05:30
Eklavya Sharma
2d3f9c8fb9
tools/lister.py: Use default arguments in add_argument.
...
Use the `default` parameter of ArgumentParser.add_argument
instead of manually setting default using the `x = x or []` pattern.
2016-05-01 07:01:52 +05:30
Tim Abbott
755695d3c0
bugdown: Add type: ignore for fenced_code import.
...
This is a workaround to allow us to type-check files that depend on
this. Ideally in the future we'll fix the type errors in
fenced_code.py.
2016-04-28 12:50:47 -07:00
Tim Abbott
d61c8f91cf
run-mypy: Link to docs on ReadTheDocs.
2016-04-28 12:35:54 -07:00
Eklavya Sharma
4310e6d224
Add tools/install-mypy.
...
This provides a way for users not using provision.py to install mypy.
[with substantial tweaks by tabbott]
2016-04-28 12:29:12 -07:00