Commit Graph

686 Commits

Author SHA1 Message Date
Florian Bruhin
3fac74656e bdd: Add some misc. tests. 2015-11-10 06:33:47 +01:00
Lamar Pavel
a2a1b77857 Undo unnecessary change 2015-11-10 03:45:38 +01:00
Lamar Pavel
fe8ddd79c0 Use config_stub.set instead of emitting sginal manually 2015-11-10 03:43:02 +01:00
Florian Bruhin
6579866abe Quote weird Qt functions for logging. 2015-11-09 19:55:05 +01:00
Florian Bruhin
d288c9598d tests: Add some quteprocess.LogLine tests. 2015-11-09 19:34:34 +01:00
Florian Bruhin
4f6415631f tests: Parse function/line being unset for LogLine. 2015-11-09 19:34:13 +01:00
Florian Bruhin
dce44f2dc5 bdd: Add some first tests for hints. 2015-11-09 18:20:23 +01:00
Florian Bruhin
1aebefca18 bdd: Make "I run ..." work with PrerequisitesError. 2015-11-09 18:20:23 +01:00
Florian Bruhin
0daf5885be Add some BDD tests for downloads. 2015-11-09 07:49:11 +01:00
Florian Bruhin
89c0ff0d9b bdd: Add a redirect-later page in webserver_sub.
This is needed for download tests.
2015-11-09 07:46:03 +01:00
Florian Bruhin
021ea444a1 bdd: Fix separations between tests.
With this change, no test should affect another one anymore. Changes in detail:

- Before each test, invalid lines are cleaned so the invalid output from the
  previous test doesn't affect the next one.
- Before each test, qutebrowser is restarted if it was quit.
- After each test, the data is cleared properly in every case.
- If there was an invalid output, the test waits for 1s for more output, and
  then terminates qutebrowser so it's restarted with a clean state.
2015-11-09 07:43:48 +01:00
Florian Bruhin
8b016df023 bdd: Make InvalidLine show some more informations. 2015-11-09 07:41:57 +01:00
Florian Bruhin
62f11273c5 tests: Fix quteproc.after_test() fixture.
It accidentally was named wrong, which caused it to never be executed. That
means the teardown log wasn't actually checked for errors.
2015-11-09 07:40:25 +01:00
Florian Bruhin
64730f566f tests: Make wait for loading work with downloads. 2015-11-09 07:39:24 +01:00
Florian Bruhin
8aa29a2ba2 bdd: Fix assert in "The requests should be" step.
When we call get_requests() inside the assertion, it won't act the same when
reinterpreting it.
2015-11-09 07:38:34 +01:00
Florian Bruhin
a05da2a956 bdd: Add a "then no crash should happen" step.
This is actually just a NOP, but helps in writing nice sentences ;)
2015-11-09 07:37:52 +01:00
Florian Bruhin
ae0e391c04 bdd: Add a "When I wait for the message ..." step. 2015-11-09 07:37:23 +01:00
Florian Bruhin
56bdb74ed9 bdd: Allow (port) replacement in "When I run ...". 2015-11-09 07:37:04 +01:00
Florian Bruhin
4c2e92c998 Make testprocess test more stable. 2015-11-06 07:17:15 +01:00
Florian Bruhin
25ecd9068c tests: Don't wait for the same line twice.
We need to search for lines in the history because we could miss something
otherwise, but for subsequent wait_for calls, we really don't want to wait for
the same thing again.

This should make test_backforward.py more stable as it *actually* waits when
going back now. Before, it did produce failures such as this one on OS X:

____________________________ test_going_backforward ____________________________
[..]
    @bdd.then(bdd.parsers.parse("The requests should be:\n{pages}"))
    def list_of_loaded_pages(httpbin, pages):
        requests = [httpbin.Request('GET', '/' + path.strip())
                    for path in pages.split('\n')]
>       assert httpbin.get_requests() == requests
E       assert [Request(verb...rward/1.txt')] == [Request(verb=...rward/2.txt')]
E         At index 3 diff: Request(verb='GET', path='/data/backforward/1.txt') != Request(verb='GET', path='/data/backforward/2.txt')
E         Full diff:
E         [Request(verb='GET', path='/data/backforward/1.txt'),
E         Request(verb='GET', path='/data/backforward/2.txt'),
E         Request(verb='GET', path='/data/backforward/1.txt'),
E         -  Request(verb='GET', path='/data/backforward/1.txt')]
E         ?                                              ^
E         +  Request(verb='GET', path='/data/backforward/2.txt')]
E         ?                                              ^
tests/integration/features/conftest.py:85: AssertionError
2015-11-06 07:02:17 +01:00
Florian Bruhin
f5f74b7ddc tests: Use a base class for testprocess lines. 2015-11-06 07:02:17 +01:00
Lamar Pavel
cbb9fd203a Fix test of existing metadata files
In test_cache_existing_metadata_file() we are now getting the correct
path to the metadata files, thus making the test useful. This was the
last missing test, the cache is now 100% covered (issue#999).
2015-11-05 23:08:38 +01:00
Florian Bruhin
5541e3ed32 bdd: Wait until title is loaded in yankpaste. 2015-11-05 08:03:03 +01:00
Florian Bruhin
b0430ca3e7 bdd: Make it possible to wait for messages. 2015-11-05 08:02:55 +01:00
Florian Bruhin
547fc9f40e Simplify testprocess tests. 2015-11-05 07:40:10 +01:00
Florian Bruhin
10e52c6e9f Make testprocess test more robust. 2015-11-05 07:39:31 +01:00
Florian Bruhin
bf74fda5b2 Fix lint. 2015-11-05 07:33:32 +01:00
Florian Bruhin
76f5f4fefb bdd: Remove now unnecessary sleep. 2015-11-05 07:07:43 +01:00
Florian Bruhin
beab639d7a bdd: Wait for finished loads in backforward. 2015-11-05 07:07:43 +01:00
Florian Bruhin
924b0052c6 bdd: Match historic messages in wait_for.
Fixes #1083.
2015-11-05 07:07:43 +01:00
Florian Bruhin
6c20190473 Merge branch 'master' of https://github.com/forkbong/qutebrowser into forkbong-master 2015-11-04 07:12:32 +01:00
Florian Bruhin
702842c977 configtypes: Handle max. recursion depth for Regex. 2015-11-04 07:02:23 +01:00
Panagiotis Ktistakis
dc06787f83 Make key config migration for clearing downloads. 2015-11-04 01:01:27 +02:00
Florian Bruhin
2c7b0d2fb4 Add some bdd tests for scrolling. 2015-11-03 22:42:25 +01:00
Florian Bruhin
49137150ad tests: Print raw yaml in get_session() in QuteProc. 2015-11-03 22:41:56 +01:00
Florian Bruhin
2427bf5cb6 bdd: Make expect_error handle warnings. 2015-11-03 22:40:19 +01:00
Florian Bruhin
17396e1030 bdd tests: Add QuteProc.get_session(). 2015-11-03 14:55:46 +01:00
Florian Bruhin
d992390cbe bdd: Move yankpaste/test.html to yankpaste.html. 2015-11-03 14:40:30 +01:00
Florian Bruhin
e31240e6c9 tests: Increase wait_for default timeout again. 2015-11-03 07:54:24 +01:00
Florian Bruhin
c78bbd9fd0 tests: Show some information for WaitForTimeout. 2015-11-03 07:53:51 +01:00
Florian Bruhin
535bcab310 bdd tests: Restart qutebrowser once per module.
This should be a good compromise between reproducibility and speed.
2015-11-03 07:00:46 +01:00
Florian Bruhin
f5eb755ef3 tests: Ignore some Qt warnings during teardown. 2015-11-03 06:38:48 +01:00
Florian Bruhin
7e0e770d53 bdd: Increase timeouts. 2015-11-03 06:35:52 +01:00
Florian Bruhin
e13de98790 Fix lint. 2015-11-02 23:49:44 +01:00
Florian Bruhin
7da0d2b6d5 Add some bdd tests for zooming. 2015-11-02 23:41:48 +01:00
Florian Bruhin
3155e20999 tests: Add helpers to compare sessions. 2015-11-02 23:41:48 +01:00
Florian Bruhin
ce6ba605e4 Reorganize bdd tests. 2015-11-02 20:32:15 +01:00
Florian Bruhin
bb4152d705 Add xfail test for vulture bug. 2015-11-02 18:25:16 +01:00
Florian Bruhin
1563693037 tests: Ignore "QIODevice::write: device not open". 2015-11-02 08:15:22 +01:00
Florian Bruhin
7431d7cf89 tests: Increase quteproc start timeout. 2015-11-02 08:08:36 +01:00
Florian Bruhin
8884de71d8 Fix checking for primary selection. 2015-11-02 08:07:25 +01:00
Florian Bruhin
672d11e25a Add bdd test for :yank/:paste. 2015-11-02 07:43:37 +01:00
Florian Bruhin
0d67cff5cb Merge branch 'bdd'
Conflicts:
      tests/test_conftest.py
      tox.ini
2015-11-02 06:36:30 +01:00
Florian Bruhin
56758c8cea Ignore messages which are in qt_log_ignore. 2015-11-02 06:19:19 +01:00
Florian Bruhin
6dc3b5de36 Add some margin to wait_for stopwatch. 2015-11-02 06:11:35 +01:00
Florian Bruhin
8e09fd929b Ignore QWaitCondition error. 2015-11-02 06:10:31 +01:00
Florian Bruhin
4451165a27 Change IPC warnings to debug.
This seems to show up on Ubuntu Trusty (with older Qt) as well...
2015-11-01 23:11:42 +01:00
Florian Bruhin
b79ccb5e79 bdd: Make message matching work. 2015-11-01 22:49:39 +01:00
Florian Bruhin
dac2898585 Parse log messages in LogLine. 2015-11-01 22:49:29 +01:00
Florian Bruhin
6431997a5a Add some testprocess tests. 2015-11-01 22:48:44 +01:00
Florian Bruhin
239bc3bdea Connect read_log before starting process. 2015-11-01 22:48:44 +01:00
Florian Bruhin
dfc1782bbf Add testprocess.wait_for to react to messages. 2015-11-01 22:48:44 +01:00
Florian Bruhin
70decdc2c8 Fix lint. 2015-11-01 22:47:58 +01:00
Florian Bruhin
4b683cdd8f Check invalid logs after exiting process. 2015-11-01 22:47:58 +01:00
Florian Bruhin
1c7fd7d80e Rename testprocess cleanup to terminate. 2015-11-01 22:47:58 +01:00
Florian Bruhin
18ead66f04 Fix odd QuteProc crash. 2015-11-01 22:47:58 +01:00
Florian Bruhin
5ed419c7f5 Make reloading more reliable.
Before, we didn't wait until the reload is done, which could lead to a race
condition.
2015-11-01 22:47:58 +01:00
Florian Bruhin
2be5c4cd27 Fix lint. 2015-11-01 22:47:58 +01:00
Florian Bruhin
1a562594fa Broken error message matching. 2015-11-01 22:40:11 +01:00
Florian Bruhin
3a948be490 Add test for unexpected error logging. 2015-11-01 22:40:11 +01:00
Florian Bruhin
ac148c11ec Skip bdd tests when frozen for now.
See:

https://github.com/pytest-dev/pytest-bdd/issues/158
https://github.com/pytest-dev/pytest-bdd/issues/159
2015-11-01 22:40:11 +01:00
Florian Bruhin
b878b139dd Ignore errors when decoding subprocess output.
This would otherwise fail on Windows because … get translated to an UTF-8 NEL
(U+0085)...
2015-11-01 22:40:11 +01:00
Florian Bruhin
be20001594 Adjust log regex to parse "Unknown module". 2015-11-01 22:40:11 +01:00
Florian Bruhin
ee8d538964 Run new qutebrowser instance for each test.
The possibilities how a test can affect another are just too high.
2015-11-01 22:40:11 +01:00
Florian Bruhin
8664e45558 Use httpbin.Request namedtuple for comparisons.
This makes it easier to look at the pytest diff when things go wrong.
2015-11-01 22:40:11 +01:00
Florian Bruhin
6e786ff9b7 Open in a new tab. 2015-11-01 22:40:11 +01:00
Florian Bruhin
4bf6359205 Rename Request.url to Request.path. 2015-11-01 22:40:11 +01:00
Florian Bruhin
c052c8a107 Don't show full debug log without --verbose. 2015-11-01 22:40:11 +01:00
Florian Bruhin
af000a8ac6 Wait longer for process to start. 2015-11-01 22:40:11 +01:00
Florian Bruhin
ffc465e863 First work-in-progress feature test. 2015-11-01 22:40:11 +01:00
Florian Bruhin
7d17957e90 Ignore inspect.getargspec() warning during tests.
https://github.com/pytest-dev/pytest-bdd/issues/153
2015-11-01 22:40:11 +01:00
Florian Bruhin
76fcec4e4c tests: First steps towards end-to-end tests. 2015-11-01 22:40:11 +01:00
Florian Bruhin
867f509bcc tests: Ignore QDisabledNetworkReply warning.
I guess they are displayed now during teardown with the changes in pytest-qt.
2015-11-01 18:04:09 +01:00
Florian Bruhin
3a522fb551 tests: Remove .close() workaround.
This is not needed anymore with pytest-qt 1.9.0.
2015-11-01 17:41:40 +01:00
Lamar Pavel
e86795f644 Add another test for pyqtslot on_config_changed
There are now two tests changing the config for private-browsing, covering
both True->False and False->True.
2015-11-01 14:55:03 +01:00
Lamar Pavel
70a6fe1561 Add tests triggering pyqtslot on_config_changed
Both settings relevant to the cache (cache-size and private-browsing) are
changed, a signal is emitted and the effect on the cache is verified.
2015-11-01 14:39:43 +01:00
Lamar Pavel
d127469d78 Add tests for fileMetaData()
One of those three tests is not complete as I couldn't yet find a way
to predict the path and name of cached files when using tmpdir.
2015-10-31 21:56:15 +01:00
Lamar Pavel
b94f7c7681 Add test for metaData() with cache deactivated 2015-10-31 18:49:58 +01:00
Lamar Pavel
404da750c6 Fix insertion into wrong cache 2015-10-31 18:32:14 +01:00
Lamar Pavel
571d7a680b Fix all other tests that weren't using DiskCache
So yeah, this explains a lot of the missing paths reported by the
coverage analysis.
2015-10-31 17:09:00 +01:00
Lamar Pavel
35762955cf Fix test_cache_remove_data
The test was not using qutebrowsers DiskCache class at all but Qts
QNetworkDiskCache. As a result the code paths of DiskCache.remove()
were never visited.
2015-10-31 16:57:00 +01:00
Lamar Pavel
3c2bc670ff Add test for alternate path of DiskCache.clear() 2015-10-31 16:33:01 +01:00
Lamar Pavel
e1446c3448 Add another test for deactivated cache
This one is testing the missing path in updateMetaData for a not activated
cache.
2015-10-31 16:28:17 +01:00
Lamar Pavel
39e37b043e Add more tests for deactivated cache
Getting closer to 100% completion, add tests for missing paths of
DiskCache.insert and DiskCache.cacheSize().
2015-10-31 16:13:29 +01:00
Florian Bruhin
468b2c4ade Merge branch 'test-browser-cache' of https://github.com/lamarpavel/qutebrowser into lamarpavel-test-browser-cache 2015-10-30 18:54:24 +01:00
Lamar Pavel
27ec9e1c43 Fix typo 2015-10-30 02:46:43 +01:00
Lamar Pavel
b5af1c8730 Add three tests querying and removing data
Two of these are testing return values of a deactivated cache and the
third is trying to query data that was never inserted into an active
cache.
2015-10-30 02:41:17 +01:00
Lamar Pavel
b3fa19eb96 Add sanity test involving almost everything 2015-10-30 02:03:34 +01:00
Lamar Pavel
05994ad90e Add theshold to cache-size test
The strict test condition before was violated by Qt internals which
seem to violate documented guarantees but are not part of qutebrowsers
code and thus can only be tested to a certain extent.
2015-10-30 01:22:16 +01:00
Lamar Pavel
9a8032fa91 Fix pylint errors (upper case variable names) 2015-10-29 03:13:25 +01:00