depot/third_party/nixpkgs/pkgs/tools/backup/gphotos-sync/skip-network-tests.patch
Default email 889482aab3 Project import generated by Copybara.
GitOrigin-RevId: f2537a505d45c31fe5d9c27ea9829b6f4c4e6ac5
2022-06-26 12:26:21 +02:00

21 lines
796 B
Diff

diff --git a/tests/test_setup.py b/tests/test_setup.py
index 085b110..ea4a7d2 100644
--- a/tests/test_setup.py
+++ b/tests/test_setup.py
@@ -45,7 +45,8 @@ class SetupDbAndCredentials:
return self
def __exit__(self, exc_type=None, exc_value=None, traceback=None):
- self.gp.google_photos_down.close()
+ if hasattr(self.gp, 'google_photos_down'):
+ self.gp.google_photos_down.close()
def test_setup(self, test_name, args=None, trash_db=False, trash_files=False):
self.root = Path("/tmp/gpTests/{}".format(test_name))
@@ -76,3 +77,6 @@ class SetupDbAndCredentials:
def test_done(self):
self.gp.data_store.store()
+
+import pytest, requests
+requests.Session.__init__ = lambda *args, **kwargs: pytest.skip("no network access")