Nico Della Torre pushed to branch master at Debian Med / pyensembl
Commits: a23a20ab by Nico Della Torre at 2026-11-20T00:26:07+01:00 Fix the source rewrite tests with coarse timestamps (Closes: #1154342) - - - - - 65e3c761 by Nico Della Torre at 2026-11-20T07:35:55+01:00 Merge branch 'fix-1154342-timestamps' into 'master' Fix the source rewrite tests with coarse timestamps (Closes: #1154342) See merge request med-team/pyensembl!2 - - - - - 3 changed files: - debian/changelog - debian/patches/series - + debian/patches/tests-coarse-timestamps.patch Changes: ===================================== debian/changelog ===================================== @@ -1,3 +1,11 @@ +pyensembl (2.33.2-2) UNRELEASED; urgency=medium + + * Team upload. + * Add patch so the source rewrite tests work with coarse timestamps + (Closes: #1154342) + + -- Nico Della Torre <[email protected]> Fri, 20 Nov 2026 00:26:07 +0100 + pyensembl (2.33.2-1) unstable; urgency=medium * New upstream version. ===================================== debian/patches/series ===================================== @@ -1,2 +1,3 @@ skip-benchmark.patch use-staged-cli-in-tests.patch +tests-coarse-timestamps.patch ===================================== debian/patches/tests-coarse-timestamps.patch ===================================== @@ -0,0 +1,76 @@ +Description: Make the source rewrite tests work with coarse timestamps + pyensembl notices a changed source by its stat() identity, ctime included. + On kernels without multigrain timestamps (before 6.13) two writes in the + same clock tick get the same ctime, so the tests that rewrite a file with + the same size can not see the change. Rewrite until ctime moves on. +Author: Nico Della Torre <[email protected]> +Bug-Debian: https://bugs.debian.org/1154342 +Forwarded: no +Last-Update: 2026-11-20 +--- +--- a/tests/test_annotation_genetic_code.py ++++ b/tests/test_annotation_genetic_code.py +@@ -5,6 +5,7 @@ import json + from pathlib import Path + import sqlite3 + import tarfile ++import time + + import datacache + import pytest +@@ -15,6 +16,15 @@ from pyensembl.database import Database + from .test_legacy_cache_compatibility import snapshot + + ++def rewrite_bytes(path, data): ++ """Write data, making sure ctime moves on even with coarse timestamps.""" ++ before = path.stat().st_ctime_ns if path.exists() else None ++ path.write_bytes(data) ++ while before is not None and path.stat().st_ctime_ns == before: ++ time.sleep(0.001) ++ path.write_bytes(data) ++ ++ + def write_gtf(path, transcript='', cds='', contig='MT', identifier='ENST1', extra=''): + attributes = 'gene_id "g"; transcript_id "%s"; transcript_version "2";' % identifier + text = ( +@@ -23,7 +33,7 @@ def write_gtf(path, transcript='', cds=' + f'{contig}\ttest\texon\t1\t9\t.\t+\t.\t{attributes} exon_id "e"; exon_number "1";\n' + f'{contig}\ttest\tCDS\t1\t9\t.\t+\t0\t{attributes} {cds}\n' + extra + ) +- path.write_bytes(gzip.compress(text.encode(), mtime=0) if path.suffix == '.gz' else text.encode()) ++ rewrite_bytes(path, gzip.compress(text.encode(), mtime=0) if path.suffix == '.gz' else text.encode()) + + + def open_genome(tmp_path, **kwargs): +--- a/tests/test_local_fasta_identity.py ++++ b/tests/test_local_fasta_identity.py +@@ -2,6 +2,7 @@ + + import gzip + import os ++import time + from pathlib import Path + + import pytest +@@ -11,10 +12,19 @@ from pyensembl.common import dump_pickle + from .test_legacy_cache_compatibility import snapshot + + ++def rewrite_bytes(path, data): ++ """Write data, making sure ctime moves on even with coarse timestamps.""" ++ before = path.stat().st_ctime_ns if path.exists() else None ++ path.write_bytes(data) ++ while before is not None and path.stat().st_ctime_ns == before: ++ time.sleep(0.001) ++ path.write_bytes(data) ++ ++ + def write_fasta(path, sequence, identifier="t"): + path.parent.mkdir(parents=True, exist_ok=True) + data = (">%s\n%s\n" % (identifier, sequence)).encode() +- path.write_bytes(gzip.compress(data, mtime=0) if path.suffix == ".gz" else data) ++ rewrite_bytes(path, gzip.compress(data, mtime=0) if path.suffix == ".gz" else data) + + + def genome_for(source, cache, copied=False, role="transcript"): View it on GitLab: https://salsa.debian.org/med-team/pyensembl/-/compare/b3233aee942cb35f7f750b25c01ebcd84ffdb018...65e3c761eb26cff67c6e282e2334951a9a2e1e44 -- View it on GitLab: https://salsa.debian.org/med-team/pyensembl/-/compare/b3233aee942cb35f7f750b25c01ebcd84ffdb018...65e3c761eb26cff67c6e282e2334951a9a2e1e44 You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
_______________________________________________ debian-med-commit mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-commit
