nixpkgs/pkgs/tools/backup/gphotos-sync/skip-network-tests.patch
2022-06-17 04:02:26 +00: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")