From: Shane Jaroch Date: Sat, 24 Jan 2026 07:42:50 +0000 (-0500) Subject: AttributeError: 'CachedSession' object has no attribute 'debug' X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=a0164cdc0112c8092478eac5d824cddbf02d8ee6;p=gamesguru%2Fgetmyancestors.git AttributeError: 'CachedSession' object has no attribute 'debug' and lint fixes --- diff --git a/Makefile b/Makefile index d60754a..63aa798 100644 --- a/Makefile +++ b/Makefile @@ -108,8 +108,8 @@ $(TEST_TARGETS): test/unit/%: test: ##H@@ Run unit & E2E tests test: test/unit test/offline test/install test/cov -.PHONY:test/ -test/:test +.PHONY: test/ +test/: test .PHONY: test/cov test/cov: ##H@@ Combine all coverage data and show report diff --git a/getmyancestors/classes/session.py b/getmyancestors/classes/session.py index b2cc603..a21ae3e 100644 --- a/getmyancestors/classes/session.py +++ b/getmyancestors/classes/session.py @@ -138,8 +138,8 @@ class GMASession(requests.Session): self.check_license() # Debug logging toggle - # Debug logging toggle - if os.environ.get("GMA_DEBUG"): + self.debug = bool(os.environ.get("GMA_DEBUG")) + if self.debug: logger = logging.getLogger() logger.setLevel(logging.DEBUG) # Add secure filter @@ -364,9 +364,9 @@ class GMASession(requests.Session): ) with context: self.set_current(auto_login=False) + if self.debug: + self.write_log(f"Backend path: {self.db_path}", "debug") if self.logged and self.fid: - if self.verbose: - self.write_log("Successfully reused cached session.") return True if self.verbose: self.write_log("Cached session invalid or expired.") diff --git a/getmyancestors/classes/tree/core.py b/getmyancestors/classes/tree/core.py index c3aa0d4..9b5602e 100644 --- a/getmyancestors/classes/tree/core.py +++ b/getmyancestors/classes/tree/core.py @@ -56,7 +56,7 @@ class ParentRelType(str, Enum): class Indi: """GEDCOM individual class - :param fid' FamilySearch id + :param fid: FamilySearch id :param tree: a tree object :param num: the GEDCOM identifier """ diff --git a/tests/offline_test.py b/tests/offline_test.py index ad04938..eac1810 100644 --- a/tests/offline_test.py +++ b/tests/offline_test.py @@ -106,7 +106,7 @@ def check_diff(generated_path, artifact_path, label): print(f"✓ {label} matches artifact exactly.") return True - print(f"⚠️ {label} differs from artifact. Showing diff (first 10 lines):") + print(f"⚠️ {label} differs from artifact. Showing diff (first 20 lines):") print("Diff Stat:") subprocess.run( [ @@ -120,9 +120,20 @@ def check_diff(generated_path, artifact_path, label): check=False, ) print("...") - subprocess.run( - ["diff", "--color=always", str(generated_path), str(artifact_path)], check=False - ) + # Cap output to avoid massive CI logs + try: + with subprocess.Popen( + ["diff", "--color=always", str(generated_path), str(artifact_path)], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + text=True, + ) as diff_proc: + stdout, _ = diff_proc.communicate(timeout=5) + print("\n".join(stdout.splitlines()[:20])) + if len(stdout.splitlines()) > 20: + print("... (truncated)") + except Exception as e: + print(f"Error running diff: {e}") print(f"❌ Verified failed for {label}") return False