Skip to content

Commit 0920cfb

Browse files
waltaskewparthea
authored andcommitted
fix(deps): drop freezegun dependency in extras (#481)
1 parent aa27260 commit 0920cfb

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

packages/google-cloud-bigquery-storage/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"pandas": ["pandas>=0.21.1"],
3333
"fastavro": ["fastavro>=0.21.2"],
3434
"pyarrow": ["pyarrow>=0.15.0"],
35-
"tests": ["freezegun"],
3635
}
3736

3837
package_root = os.path.abspath(os.path.dirname(__file__))

packages/google-cloud-bigquery-storage/tests/unit/test_writer_v1.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import time
1516
from unittest import mock
1617

17-
import freezegun
1818
import pytest
1919

2020
from google.api_core import exceptions
@@ -128,10 +128,11 @@ def test_initial_send_with_timeout(background_consumer, bidi_rpc, module_under_t
128128
initial_request = gapic_types.AppendRowsRequest(
129129
write_stream="this-is-a-stream-resource-path"
130130
)
131-
132-
with pytest.raises(exceptions.Unknown), freezegun.freeze_time(
133-
auto_tick_seconds=module_under_test._DEFAULT_TIMEOUT + 1
134-
):
131+
now = time.monotonic()
132+
later = now + module_under_test._DEFAULT_TIMEOUT + 1
133+
with mock.patch.object(module_under_test.time, "sleep"), mock.patch.object(
134+
module_under_test.time, "monotonic", mock.MagicMock(side_effect=(now, later))
135+
), pytest.raises(exceptions.Unknown):
135136
manager.send(initial_request)
136137

137138

packages/google-cloud-bigquery-storage/tests/unit/test_writer_v1beta2.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import time
1516
from unittest import mock
1617

17-
import freezegun
1818
import pytest
1919

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

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

137139

0 commit comments

Comments
 (0)