diff options
author | Irina Truong <i.chernyavska@gmail.com> | 2021-05-21 15:32:34 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-21 15:32:34 -0700 |
commit | e0a4c18c4a074016beef46886b03e456102e2db1 (patch) | |
tree | 8e0f57064035bd73faab5d4dea3446dc2c5c376c /tests/test_completion_refresher.py | |
parent | d8532df22e1f309c8a05a452d752bd30f4869bbe (diff) |
Another attempt to fix pgbouncer error (1093.) (#1097)
* Another attempt to fix pgbouncer error (1093.)
* Fixes for various pgbouncer problems.
* different approach with custom cursor.
* Fix rebase.
* Missed this.
* Fix completion refresher test.
* Black.
* Unused import.
* Changelog.
* Fix race condition in test.
* Switch from is_pgbouncer to more generic is_virtual_database, and duck-type it. Add very dumb unit test for virtual cursor.
* Remove debugger code.
Diffstat (limited to 'tests/test_completion_refresher.py')
-rw-r--r-- | tests/test_completion_refresher.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/test_completion_refresher.py b/tests/test_completion_refresher.py index 34cf5700..a5529d6b 100644 --- a/tests/test_completion_refresher.py +++ b/tests/test_completion_refresher.py @@ -37,7 +37,7 @@ def test_refresh_called_once(refresher): :return: """ callbacks = Mock() - pgexecute = Mock() + pgexecute = Mock(**{"is_virtual_database.return_value": False}) special = Mock() with patch.object(refresher, "_bg_refresh") as bg_refresh: @@ -57,7 +57,7 @@ def test_refresh_called_twice(refresher): """ callbacks = Mock() - pgexecute = Mock() + pgexecute = Mock(**{"is_virtual_database.return_value": False}) special = Mock() def dummy_bg_refresh(*args): @@ -84,14 +84,12 @@ def test_refresh_with_callbacks(refresher): :param refresher: """ callbacks = [Mock()] - pgexecute_class = Mock() - pgexecute = Mock() + pgexecute = Mock(**{"is_virtual_database.return_value": False}) pgexecute.extra_args = {} special = Mock() - with patch("pgcli.completion_refresher.PGExecute", pgexecute_class): - # Set refreshers to 0: we're not testing refresh logic here - refresher.refreshers = {} - refresher.refresh(pgexecute, special, callbacks) - time.sleep(1) # Wait for the thread to work. - assert callbacks[0].call_count == 1 + # Set refreshers to 0: we're not testing refresh logic here + refresher.refreshers = {} + refresher.refresh(pgexecute, special, callbacks) + time.sleep(1) # Wait for the thread to work. + assert callbacks[0].call_count == 1 |