Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): drop freezegun dependency in extras #481

Merged
merged 1 commit into from
Aug 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"pandas": ["pandas>=0.21.1"],
"fastavro": ["fastavro>=0.21.2"],
"pyarrow": ["pyarrow>=0.15.0"],
"tests": ["freezegun"],
}

package_root = os.path.abspath(os.path.dirname(__file__))
Expand Down
11 changes: 6 additions & 5 deletions tests/unit/test_writer_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import time
from unittest import mock

import freezegun
import pytest

from google.api_core import exceptions
Expand Down Expand Up @@ -128,10 +128,11 @@ def test_initial_send_with_timeout(background_consumer, bidi_rpc, module_under_t
initial_request = gapic_types.AppendRowsRequest(
write_stream="this-is-a-stream-resource-path"
)

with pytest.raises(exceptions.Unknown), freezegun.freeze_time(
auto_tick_seconds=module_under_test._DEFAULT_TIMEOUT + 1
):
now = time.monotonic()
later = now + module_under_test._DEFAULT_TIMEOUT + 1
with mock.patch.object(module_under_test.time, "sleep"), mock.patch.object(
module_under_test.time, "monotonic", mock.MagicMock(side_effect=(now, later))
), pytest.raises(exceptions.Unknown):
manager.send(initial_request)


Expand Down
10 changes: 6 additions & 4 deletions tests/unit/test_writer_v1beta2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import time
from unittest import mock

import freezegun
import pytest

from google.api_core import exceptions
Expand Down Expand Up @@ -129,9 +129,11 @@ def test_initial_send_with_timeout(background_consumer, bidi_rpc, module_under_t
write_stream="this-is-a-stream-resource-path"
)

with pytest.raises(exceptions.Unknown), freezegun.freeze_time(
auto_tick_seconds=module_under_test._DEFAULT_TIMEOUT + 1
):
now = time.monotonic()
later = now + module_under_test._DEFAULT_TIMEOUT + 1
with mock.patch.object(module_under_test.time, "sleep"), mock.patch.object(
module_under_test.time, "monotonic", mock.MagicMock(side_effect=(now, later))
), pytest.raises(exceptions.Unknown):
manager.send(initial_request)


Expand Down