summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-07-12 16:03:41 +0200
committerFlorian Bruhin <me@the-compiler.org>2021-07-12 16:03:41 +0200
commit204721836133485efb1acba6d2795193788f9eda (patch)
tree6983bd6a5d0d34df823f0536255f8aa9d11ed2f8 /tests
parentbf373e0ff66659af2b2b0114d0a5a2e286effa7c (diff)
downloadqutebrowser-204721836133485efb1acba6d2795193788f9eda.tar.gz
qutebrowser-204721836133485efb1acba6d2795193788f9eda.zip
Revert "Fix enum stringification for Python 3.10 a7+"
This reverts commit e2c5fe6262564d9d85806bfa9d4486a411cf5045. See https://mail.python.org/archives/list/python-dev@python.org/thread/ZMC67QA2JVQJSWSFWRS6IM6ZX4EK277G/#LSTMFAPSPD3BGZ4D6HQFODXZVB3PLYKF
Diffstat (limited to 'tests')
-rw-r--r--tests/end2end/features/downloads.feature24
-rw-r--r--tests/end2end/features/misc.feature2
-rw-r--r--tests/end2end/features/qutescheme.feature2
-rw-r--r--tests/end2end/features/test_downloads_bdd.py2
-rw-r--r--tests/unit/utils/test_utils.py28
5 files changed, 15 insertions, 43 deletions
diff --git a/tests/end2end/features/downloads.feature b/tests/end2end/features/downloads.feature
index 6448e7809..dfdb24704 100644
--- a/tests/end2end/features/downloads.feature
+++ b/tests/end2end/features/downloads.feature
@@ -79,7 +79,7 @@ Feature: Downloading things from a website.
And I set downloads.location.prompt to true
And I open data/downloads/issue1243.html
And I hint with args "links download" and follow a
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='qutebrowser-download' mode=PromptMode.download option=None text=* title='Save file to:'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='qutebrowser-download' mode=<PromptMode.download: 5> option=None text=* title='Save file to:'>, *" in the log
Then the error "Download error: No handler found for qute://" should be shown
And "NotFoundError while handling qute://* URL" should be logged
@@ -88,7 +88,7 @@ Feature: Downloading things from a website.
And I set downloads.location.prompt to true
And I open data/data_link.html
And I hint with args "links download" and follow s
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='download.pdf' mode=PromptMode.download option=None text=* title='Save file to:'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='download.pdf' mode=<PromptMode.download: 5> option=None text=* title='Save file to:'>, *" in the log
And I run :mode-leave
Then no crash should happen
@@ -96,7 +96,7 @@ Feature: Downloading things from a website.
When I set downloads.location.suggestion to filename
And I set downloads.location.prompt to true
And I open data/downloads/download.bin in a new window without waiting
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=PromptMode.download *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=<PromptMode.download: 5> *" in the log
And I run :window-only
And I run :mode-leave
Then no crash should happen
@@ -164,7 +164,7 @@ Feature: Downloading things from a website.
Scenario: Downloading a file to a reserved path
When I set downloads.location.prompt to true
And I open data/downloads/download.bin without waiting
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=PromptMode.download option=None text='Please enter a location for <b>http://localhost:*/data/downloads/download.bin</b>' title='Save file to:'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=<PromptMode.download: 5> option=None text='Please enter a location for <b>http://localhost:*/data/downloads/download.bin</b>' title='Save file to:'>, *" in the log
And I run :prompt-accept COM1
And I run :mode-leave
Then the error "Invalid filename" should be shown
@@ -173,7 +173,7 @@ Feature: Downloading things from a website.
Scenario: Downloading a file to a drive-relative working directory
When I set downloads.location.prompt to true
And I open data/downloads/download.bin without waiting
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=PromptMode.download option=None text='Please enter a location for <b>http://localhost:*/data/downloads/download.bin</b>' title='Save file to:'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=<PromptMode.download: 5> option=None text='Please enter a location for <b>http://localhost:*/data/downloads/download.bin</b>' title='Save file to:'>, *" in the log
And I run :prompt-accept C:foobar
And I run :mode-leave
Then the error "Invalid filename" should be shown
@@ -247,14 +247,14 @@ Feature: Downloading things from a website.
Scenario: :download with a filename and directory which doesn't exist
When I run :download --dest (tmpdir)(dirsep)downloads(dirsep)somedir(dirsep)file http://localhost:(port)/data/downloads/download.bin
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default=None mode=PromptMode.yesno option=None text='<b>*</b> does not exist. Create it?' title='Create directory?'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default=None mode=<PromptMode.yesno: 1> option=None text='<b>*</b> does not exist. Create it?' title='Create directory?'>, *" in the log
And I run :prompt-accept yes
And I wait until the download is finished
Then the downloaded file somedir/file should exist
Scenario: :download with a directory which doesn't exist
When I run :download --dest (tmpdir)(dirsep)downloads(dirsep)somedir(dirsep) http://localhost:(port)/data/downloads/download.bin
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default=None mode=PromptMode.yesno option=None text='<b>*</b> does not exist. Create it?' title='Create directory?'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default=None mode=<PromptMode.yesno: 1> option=None text='<b>*</b> does not exist. Create it?' title='Create directory?'>, *" in the log
And I run :prompt-accept yes
And I wait until the download is finished
Then the downloaded file somedir/download.bin should exist
@@ -279,13 +279,13 @@ Feature: Downloading things from a website.
When I set downloads.location.prompt to true
And I open data/title.html
And I run :download --mhtml
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=PromptMode.download option=None text='Please enter a location for <b>http://localhost:*/data/title.html</b>' title='Save file to:'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=<PromptMode.download: 5> option=None text='Please enter a location for <b>http://localhost:*/data/title.html</b>' title='Save file to:'>, *" in the log
And I run :prompt-accept
And I wait for "File successfully written." in the log
And I run :download --mhtml
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=PromptMode.download option=None text='Please enter a location for <b>http://localhost:*/data/title.html</b>' title='Save file to:'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=<PromptMode.download: 5> option=None text='Please enter a location for <b>http://localhost:*/data/title.html</b>' title='Save file to:'>, *" in the log
And I run :prompt-accept
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default=None mode=PromptMode.yesno option=None text='<b>*</b> already exists. Overwrite?' title='Overwrite existing file?'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default=None mode=<PromptMode.yesno: 1> option=None text='<b>*</b> already exists. Overwrite?' title='Overwrite existing file?'>, *" in the log
And I run :prompt-accept yes
And I wait for "File successfully written." in the log
Then the downloaded file Test title.mhtml should exist
@@ -655,9 +655,9 @@ Feature: Downloading things from a website.
Scenario: Answering a question for a cancelled download (#415)
When I set downloads.location.prompt to true
And I run :download http://localhost:(port)/data/downloads/download.bin
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=PromptMode.download option=None text=* title='Save file to:'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=<PromptMode.download: 5> option=None text=* title='Save file to:'>, *" in the log
And I run :download http://localhost:(port)/data/downloads/download2.bin
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=PromptMode.download option=None text=* title='Save file to:'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='*' mode=<PromptMode.download: 5> option=None text=* title='Save file to:'>, *" in the log
And I run :download-cancel with count 2
And I run :prompt-accept
And I wait until the download is finished
diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature
index 3951dd2b0..e6a02e038 100644
--- a/tests/end2end/features/misc.feature
+++ b/tests/end2end/features/misc.feature
@@ -196,7 +196,7 @@ Feature: Various utility commands.
# We can't use "When I open" because we don't want to wait for load
# finished
When I run :open http://localhost:(port)/redirect-later?delay=-1
- And I wait for "emitting: cur_load_status_changed(*loading*) (tab *)" in the log
+ And I wait for "emitting: cur_load_status_changed(<LoadStatus.loading: *>) (tab *)" in the log
And I wait 1s
And I run :stop
And I open redirect-later-continue in a new tab
diff --git a/tests/end2end/features/qutescheme.feature b/tests/end2end/features/qutescheme.feature
index bb556df53..039434f1c 100644
--- a/tests/end2end/features/qutescheme.feature
+++ b/tests/end2end/features/qutescheme.feature
@@ -192,7 +192,7 @@ Feature: Special qute:// pages
And I open data/misc/test.pdf without waiting
And I wait for "[qute://pdfjs/*] PDF * (PDF.js: *)" in the log
And I run :jseval document.getElementById("download").click()
- And I wait for "Asking question <qutebrowser.utils.usertypes.Question default=* mode=PromptMode.download option=None text=* title='Save file to:'>, *" in the log
+ And I wait for "Asking question <qutebrowser.utils.usertypes.Question default=* mode=<PromptMode.download: 5> option=None text=* title='Save file to:'>, *" in the log
And I run :mode-leave
Then no crash should happen
diff --git a/tests/end2end/features/test_downloads_bdd.py b/tests/end2end/features/test_downloads_bdd.py
index f7b19b4b0..804ed40fe 100644
--- a/tests/end2end/features/test_downloads_bdd.py
+++ b/tests/end2end/features/test_downloads_bdd.py
@@ -28,7 +28,7 @@ bdd.scenarios('downloads.feature')
PROMPT_MSG = ("Asking question <qutebrowser.utils.usertypes.Question "
- "default={!r} mode=PromptMode.download option=None "
+ "default={!r} mode=<PromptMode.download: 5> option=None "
"text=* title='Save file to:'>, *")
diff --git a/tests/unit/utils/test_utils.py b/tests/unit/utils/test_utils.py
index 42b95a1a8..57adc883c 100644
--- a/tests/unit/utils/test_utils.py
+++ b/tests/unit/utils/test_utils.py
@@ -546,34 +546,6 @@ class TestIsEnum:
assert not utils.is_enum(23)
-class SomeEnum(enum.Enum):
-
- some_value = enum.auto()
-
-
-class TestPyEnumStr:
-
- @pytest.fixture
- def val(self):
- return SomeEnum.some_value
-
- def test_fake_old_python_version(self, monkeypatch, val):
- monkeypatch.setattr(sys, 'version_info', (3, 9, 2))
- assert utils.pyenum_str(val) == str(val)
-
- def test_fake_new_python_version(self, monkeypatch, val):
- monkeypatch.setattr(sys, 'version_info', (3, 10, 0))
- assert utils.pyenum_str(val) == repr(val)
-
- def test_real_result(self, val):
- assert utils.pyenum_str(val) == 'SomeEnum.some_value'
-
- @pytest.mark.skipif(sys.version_info[:2] < (3, 10), reason='Needs Python 3.10+')
- def test_needed(self, val):
- """Fail if this change gets revered before the final 3.10 release."""
- assert str(val) != 'SomeEnum.some_value'
-
-
class TestRaises:
"""Test raises."""