Skip to content

Commit

Permalink
fix(deps): drop freezegun dependency in extras (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
waltaskew authored Aug 6, 2022
1 parent 0aaeda9 commit 7ba7953
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
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

0 comments on commit 7ba7953

Please sign in to comment.