Commit Graph

402 Commits

Author SHA1 Message Date
Florian Bruhin
5817b47f75 Revert "Use fully qualified imports in tests."
Seems like this also breaks frozen tests...
This reverts commit c7fdcc92b8.
2015-12-01 22:45:59 +01:00
Florian Bruhin
109984c96e pylint: Check attr-defined-outside-init for tests. 2015-12-01 22:41:16 +01:00
Florian Bruhin
803398c49b Use some more fixtures for older tests. 2015-12-01 22:40:58 +01:00
Florian Bruhin
c7fdcc92b8 Use fully qualified imports in tests.
This is cleaner even if pylint can't handle it.
2015-12-01 22:03:59 +01:00
Florian Bruhin
150a83d8f4 pylint: Remove unneeded supressions. 2015-12-01 22:03:58 +01:00
Tomasz Kramkowski
c575435782 misc/editor: Fix tempfile deleted on error / editor crash
This patch attempts to fix an issue where an error occuring in
misc/guiprocess or the editor process crashing would delete the
temporary file thus making it impossible to recover changes not commited
to the form field from the editor.
2015-12-01 20:22:05 +00:00
Florian Bruhin
f7a13fa1f9 Rename LineParserWrapper to LineParserMixin.
This makes pylint shut up as it realizes it is, in fact, a mixin.
2015-11-30 07:11:35 +01:00
Florian Bruhin
288bf1524e Fix some unidiomatic comparisons. 2015-11-30 07:10:21 +01:00
Florian Bruhin
d286f637d6 tests: Set basedir to None, not ''.
Turns out setting basedir='' creates cache/ in cwd.
2015-11-29 01:23:28 +01:00
Florian Bruhin
6a46aea934 Fix tests for basedir logging.
f5febc4 broke various tests which called standarddir.init() without a valid
basedir.
2015-11-29 00:35:18 +01:00
Florian Bruhin
c236e70920 Merge branch 'log-javascript-console' of https://github.com/flv0/qutebrowser into flv0-log-javascript-console 2015-11-28 21:12:25 +01:00
Florian Bruhin
83b94a8be5 Fix session tests.
FakeMainWindow needs to be a QObject now as we use sip.isdeleted since
8cf6ace0e7 and that raises a TypeError on
non-QObject's.
2015-11-28 20:41:42 +01:00
Patric Schmitz
913aa209c6 remove BadMappingSubclass and rename MappingSubclass 2015-11-28 20:17:31 +01:00
Patric Schmitz
dbc6f63fc0 remove whitespace 2015-11-28 18:57:41 +01:00
Patric Schmitz
03ba38578e set valid_values after __init__ consistently, move type validation out of class into pytest 2015-11-28 18:29:51 +01:00
Patric Schmitz
c14b52f916 initialize valid_values separately, not using base class __init__ parameter 2015-11-28 18:29:51 +01:00
Patric Schmitz
6f65397dfe always set valid_values in __init__ instead of class scope variable 2015-11-28 18:29:51 +01:00
Florian Bruhin
962ba36cda Skip qtutils.savefile_open tests without DISPLAY.
I don't get why, but for some reason they cause a segfault from time to time...
So let's just skip them.
2015-11-27 19:11:37 +01:00
Florian Bruhin
be4cf19bb1 tests: Improve some parametrized test IDs. 2015-11-27 16:25:25 +01:00
Florian Bruhin
f3c378858b tests: Remove duplicate test_split testcases. 2015-11-27 16:22:48 +01:00
Florian Bruhin
951c2e8eb6 Fix qflags_key comparison. 2015-11-25 18:54:03 +01:00
Florian Bruhin
67f726c9d4 tests: Add another BOM test for javascript_escape. 2015-11-25 18:47:16 +01:00
Florian Bruhin
73e9fd1118 Handle BOM (\ufeff) for webelem.javascript_escape. 2015-11-25 18:14:52 +01:00
Florian Bruhin
24a71e5c2e Fix webelem.javascript_escape with U+2028/U+2029. 2015-11-25 10:32:22 +01:00
Florian Bruhin
14f4689998 tests: Fix TestInitLog.
This worked before b0d4ebe because --debug was given and the
"args.loglevel.upper()" part was never executed.

However, loglevel is expected as a string, not as an int.
2015-11-23 21:50:48 +01:00
Florian Bruhin
196d1e95be tests: Skip test_normal_connection IPC test on OS X.
Seems like it hangs there sometimes.
2015-11-23 20:33:11 +01:00
Florian Bruhin
16e1a65448 Merge branch 'download-page' of https://github.com/Kingdread/qutebrowser into Kingdread-download-page 2015-11-23 13:16:16 +01:00
Daniel Schadt
c12011c84d Style fixes 2015-11-21 00:10:49 +01:00
Florian Bruhin
1ec03462c8 Add a utils.parse_keystring. 2015-11-20 07:06:16 +01:00
Daniel Schadt
3438a45b19 Merge branch 'master' into download-page 2015-11-18 19:27:26 +01:00
Florian Bruhin
dd2ec30b97 Revert "Use parametrization for TestKeyToString:test_all."
This reverts commit aa1ea9b063.

I changed my mind on this, generating >400 tests for this is stupid.
2015-11-18 18:15:21 +01:00
Florian Bruhin
eeab4d41ba Make it possible to pass a count via command name.
This is only used for tests so far and not intended for general usage (and thus
undocumented).
2015-11-15 19:55:01 +01:00
Florian Bruhin
9607fae935 Skip check_coverage.py with --lf. 2015-11-13 22:43:12 +01:00
Florian Bruhin
b61462ccb8 Fix the style fixes. 2015-11-13 22:41:37 +01:00
Florian Bruhin
1da7996c3b Style fixes. 2015-11-13 22:27:41 +01:00
Florian Bruhin
40c7990d3a tests: Skip ipc TestSendToRunningInstance on OS X.
This did hang often on OS X, and I don't have the time to properly debug this.

See #1045.
2015-11-12 22:17:37 +01:00
Florian Bruhin
3680f01576 Switch to pytest 2.8.
Closes #1077.

There were two issues:

- Paths for coverage.py suddenly were absolute instead of relative, so we strip
  the common base part if that happens.

  /home/florian/proj/qutebrowser/git/qutebrowser/browser/cookies.py has 100%
  coverage but is not in perfect_files!
  /home/florian/proj/qutebrowser/git/qutebrowser/browser/http.py has 100%
  coverage but is not in perfect_files!
  [...]

- There was an io.UnsupportedOperationError in test_check_coverage.py because
  of pytest-faulthandler, so we just don't load that in the subprocess.
2015-11-11 20:57:47 +01:00
Florian Bruhin
416cfaf002 tests: Switch from pytest-capturelog to catchlog. 2015-11-11 19:57:03 +01:00
Florian Bruhin
7cddd52b2d Merge branch 'download-page' of https://github.com/Kingdread/qutebrowser into Kingdread-download-page 2015-11-10 22:39:07 +01:00
Florian Bruhin
250f0e7410 Merge branch 'test-browser-cache-more' of https://github.com/lamarpavel/qutebrowser into lamarpavel-test-browser-cache-more 2015-11-10 18:57:28 +01:00
Florian Bruhin
e1c6cd6c6d tests: Skip test_file for PyQIODevice on OS X.
Those seem to cause a hang on Travis on OS X sometimes.
2015-11-10 08:55:31 +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
Daniel
a1bc020fec mhtml: Sanitize default filename suggestion 2015-11-09 17:01:08 +01:00
Daniel
5601c8e7c1 mhtml: Skip test if cssutils is unavailable
Instead of failing the test (assert cssutils is not None)
2015-11-09 17:01:08 +01:00
Daniel
ae8a9b8798 Handle non-ASCII in headers/url better 2015-11-09 17:01:08 +01:00
Daniel
f2f9529af7 Remove sys import in test_mhtml 2015-11-09 17:01:08 +01:00
Daniel
ed8a6a4c7b Update to cssutils 1.0.1
This fixes cssutils on Python 3.5 (yay!).
2015-11-09 17:01:08 +01:00
Daniel
3a2bb2d348 Add cssutils to README and utils/version.py 2015-11-09 17:01:08 +01:00
Daniel
dd8ff860f4 Fix lint 2015-11-09 16:59:16 +01:00
Daniel
b027e6af1b Mark cssutils tests as xfail on Python >= 3.5 2015-11-09 16:59:16 +01:00
Daniel
dab0db30a5 Remove tests for remove_file from test_mhtml.py 2015-11-09 16:59:16 +01:00
Daniel
957d68c477 Revert "Remove cssutils from mhtml.py"
This reverts commit 22a0f0952704d284846ab2572790d99a85515c57.
2015-11-09 16:59:16 +01:00
Daniel
ce1a99cc7c Remove cssutils from mhtml.py 2015-11-09 16:59:16 +01:00
Daniel
420c087373 use cssutils 2015-11-09 16:59:16 +01:00
Daniel
749b1c02cc Style changes for mhtml and test_mhtml 2015-11-09 16:59:16 +01:00
Daniel
b05a0d191d Fix module path in test_mhtml
Also fix docstring for _get_css_imports
2015-11-09 16:59:16 +01:00
Daniel
2eeace1c2c Move misc.mhtml to browser.mhtml 2015-11-09 16:59:16 +01:00
Daniel
a092ef1fe6 String quote style changes
"" for user facing strings
'' for internal strings
except when quotes appear inside a string, to avoid escaping them
2015-11-09 16:59:16 +01:00
Daniel
9bf9124324 Fix mhtml tests, add test for _NoCloseBytesIO 2015-11-09 16:59:16 +01:00
Daniel
bf90c8c06b Add tests for mhtml
This also makes the output of MHTMLWriter deterministic, by

1) Setting the boundary at object creation, allowing uuid.uuid4 to be
   monkey patched

2) Outputting the files in sorted order (sorted by location), as python
   dicts are unordered by default.
2015-11-09 16:59:16 +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
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
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
0d67cff5cb Merge branch 'bdd'
Conflicts:
      tests/test_conftest.py
      tox.ini
2015-11-02 06:36:30 +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
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
Lamar Pavel
a6526a1be2 Add tests to update and verify meta data of cache entries 2015-10-29 02:57:16 +01:00
Lamar Pavel
2cab750a54 Add test for DiskCache.remove() 2015-10-29 02:37:32 +01:00
Lamar Pavel
e4c79a68d1 re-write tests to fill the cache
Previously the tests were not adding any data to the cache, making the
tests for a cache size other than 0 meaningless.
The new tests create cache entries and fill them with some data that
can be tested against.
2015-10-29 02:28:57 +01:00
Florian Bruhin
6f07eb562f Revert "Don't use faulthandler plugin for check_coverage."
This reverts commit 497fba5667.
2015-10-28 08:22:41 +01:00
Florian Bruhin
497fba5667 Don't use faulthandler plugin for check_coverage. 2015-10-28 07:45:34 +01:00
Florian Bruhin
c85aa40073 Skip connected_socket IPC tests on OS X.
Fixes #1045 - I don't have the time to look into this :-/
2015-10-26 09:04:41 +01:00
Florian Bruhin
883febe243 Return a QColor for qtutils.interpolate_color.
This broke the tests for older PyQt versions because the test had a
test_utils.Color(test_utils.Color(...)) object (double-wrapped), and the
comparisons failed there for some reason.
2015-10-26 06:45:36 +01:00
Florian Bruhin
bb5e5137cd configtypes: Allow completions for String. 2015-10-25 21:18:06 +01:00
Florian Bruhin
f614e5b98a Add none value for colors -> tabs.indicator.system. 2015-10-24 16:01:32 +02:00
Florian Bruhin
cdb9c0998f Add a comment for close() call. 2015-10-24 08:07:43 +02:00
Daniel
9722d4ba03 test_tabwidget: Make config_stub explicit
... also call TabWidget.close() at the end of the test.
2015-10-24 01:32:01 +02:00
Daniel
279d0926ee Remove unused import, make pylint happy 2015-10-23 19:52:56 +02:00
Daniel
0851999b89 Add unit/regression test 2015-10-23 19:52:56 +02:00
Lamar Pavel
24887a6564 Adjust coding style based on pylint warnings 2015-10-23 01:49:00 +02:00
Lamar Pavel
4a8dec5eb8 Code style; complete first batch of tests. 2015-10-21 22:31:46 +02:00
Lamar Pavel
82c608038d Coding style 2015-10-21 22:31:46 +02:00
Lamar Pavel
0b78fb65c9 Test if cleared cache is actually empty 2015-10-21 22:31:46 +02:00
Lamar Pavel
aa62a547d5 Use tmpdir fixture instead of "/foo/bar" 2015-10-21 22:31:46 +02:00
Lamar Pavel
a99d3f6525 Add first 3 tests for browser.cache
Note: test_cache_deactivated_private_browsing is currently failing
2015-10-21 22:31:46 +02:00
Daniel
ef8a681fcc Add TimestampTemplate config type
No more crash when 'completion->timestamp-format' is set to '%'.

Fixes #1039.
2015-10-21 17:23:39 +02:00
Florian Bruhin
4fb374e764 Fix test_run_vulture when frozen. 2015-10-21 06:11:07 +02:00
Florian Bruhin
aba31babca Add some tests for run_vulture.py. 2015-10-20 23:42:01 +02:00
Nathan Isom
ec3cafc293 resolve merge conflicts and merge branch scrollbar. 2015-10-18 11:42:56 -05:00
Florian Bruhin
82dfec6a18 Merge branch 'templatemagic' of https://github.com/neeasade/qutebrowser into neeasade-templatemagic 2015-10-18 18:20:41 +02:00
Nathan Isom
e92a7495c4 keep bg/fg test. 2015-10-18 10:41:15 -05:00
Nathan Isom
f1b9a3408f Remove fontdict test, edit register stylesheet test to match new font result. 2015-10-17 19:23:48 -05:00
Florian Bruhin
c8346a11fc Merge branch 'jinja' of https://github.com/meles5/qutebrowser into meles5-jinja 2015-10-17 19:04:36 +02:00
meles5
78c57ad416 Fixed AppVeyor test 2015-10-17 18:43:14 +02:00
meles5
2398762e85 Fix tests 2015-10-17 18:29:13 +02:00
Nathan Isom
9b8b2130ef remove deprecated test. 2015-10-16 10:59:02 -05:00
Nathan Isom
2a11adc8ac initial replace pass. 2015-10-16 10:52:02 -05:00
Nathan Isom
27db1ad891 fix scrollbar not showing up error, change test_get_stylesheet a bit. 2015-10-16 09:56:31 -05:00
Florian Bruhin
24dc166e1f tests: Use extend=True for qt_log_ignore marks.
This should finally resolve the warning flakiness on OS X.
2015-10-16 06:24:29 +02:00
John ShaggyTwoDope Jenkins
65418307fd typos 2015-10-13 16:09:49 -07:00
Florian Bruhin
129df05932 ipc: Skip socketOptions test on Qt < 5.4. 2015-10-07 22:04:30 +02:00
Florian Bruhin
7db1f65425 ipc: Avoid using QLocalServer.setSocketOptions.
This causes problems with AddressInUseError being swallowed.

Fixes #997.
2015-10-07 21:52:09 +02:00
Jonas Schürmann
afc166a13e Coding style fixes #1002 2015-10-06 22:59:49 +02:00
Jonas Schürmann
45c9768c16 Added --target command line argument #922
This argument is used to override the new-instance-open-target config
option.
2015-10-05 21:15:52 +02:00
Florian Bruhin
cabbe406e3 tests: Fix ignoring of "load glyph failed" message.
The mark seems to be swallowed somehow when it's after @hypothesis.given.

See https://github.com/DRMacIver/hypothesis/issues/189
2015-10-05 08:11:26 +02:00
Florian Bruhin
f4fdcbdd71 Add a --check-all to check_coverage.py. 2015-10-04 20:35:24 +02:00
Florian Bruhin
54ae1582af Make check_coverage work when called with a file. 2015-10-04 19:36:26 +02:00
Florian Bruhin
55efd1358b Work around coverage.py bug in test_check_coverage.
Fixes #981.
See https://bitbucket.org/ned/coveragepy/issues/422/
2015-10-04 18:33:37 +02:00
Florian Bruhin
de49e5f0a5 Use 'is None' to compare to None. 2015-10-04 17:05:24 +02:00
Florian Bruhin
7ff881c3e3 Merge branch 'incdec-setting' of https://github.com/Kingdread/qutebrowser into Kingdread-incdec-setting 2015-10-04 17:04:40 +02:00
Florian Bruhin
d229e90724 Fix some splelling mistakes. 2015-10-04 15:41:42 +02:00
Daniel
73ba3ddaee Add all possible combinations to FlagList.complete 2015-10-02 18:53:03 +02:00
Daniel
f12fbe875e Use a two-digit number for incdec tests 2015-10-02 11:44:54 +02:00
Florian Bruhin
7761dd5af4 configtypes: Disallow ValidValues without values. 2015-10-02 11:37:41 +02:00
Daniel
c78f83e692 Add port numbers to incdec_number tests 2015-10-02 11:27:56 +02:00
Florian Bruhin
240e271b0d tests: Translate platform markers to skipif marks.
This means pytest shows the correct location and the marks work correctly when
marking individual items in a parametrize marker.
2015-10-02 09:26:33 +02:00
Florian Bruhin
18bd20e109 Skip test_ipc:test_timeout on OS X.
It almost always causes issues and I have no idea why... Let's skip it for now.

Fixes #975.
2015-10-02 08:52:51 +02:00
Florian Bruhin
9f7836131d tests: Add a reason argument to platform markers. 2015-10-02 08:51:22 +02:00
Florian Bruhin
5c52d4d04e Fix TestGitStrSubprocess.test_real_git on Windows.
Fixes #939.
2015-10-02 07:36:06 +02:00
Florian Bruhin
93ed853c36 Fix tests on Xvfb.
Fixes #984.
2015-10-02 07:07:38 +02:00
Florian Bruhin
d6301beb2a Improve configtypes.Regex tests and docs. 2015-10-01 23:24:27 +02:00
Florian Bruhin
16ac3baf2e configtypes: Handle invalid escapes in regexes. 2015-10-01 23:11:48 +02:00
Daniel
c9a959043b Smarter tests for incdec_number
Now we generate possible combinations automatically instead of listing
several example values by hand.
2015-10-01 21:27:05 +02:00
Daniel
8228a96180 Stylistic changes, more testing for incdec 2015-10-01 20:57:08 +02:00
Alexey Nabrodov
293c9f1022 trying to fix tests 2 2015-10-01 16:34:34 +03:00
Alexey Nabrodov
044c0a0c4f trying to fix tests 2015-10-01 16:26:56 +03:00
Alexey Nabrodov
54d4f4f48b refactor and test 2015-10-01 15:57:11 +03:00
Daniel
4881d81444 Add new configtype: FlagList
This class contains validation code shared by ConfirmQuit and
URLSegmentList, that is it checks for duplicate values and compares
each value to valid_values.
2015-10-01 00:40:21 +02:00
Daniel
bc631d7d8b Fix configtypes test coverage 2015-09-30 21:17:27 +02:00