[med-svn] [python-intervaltree-bio] 05/09: Set up build-time tests

Afif Elghraoui afif at moszumanska.debian.org
Sun Dec 11 06:28:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

afif pushed a commit to branch master
in repository python-intervaltree-bio.

commit c893f930634467b02febf735cf00a3eec3719aac
Author: Afif Elghraoui <afif at debian.org>
Date:   Sat Dec 10 18:12:58 2016 -0800

    Set up build-time tests
---
 debian/data/README                                 |   5 ++
 debian/data/ensGene.txt.gz                         | Bin 0 -> 8602766 bytes
 debian/data/knownGene.txt.gz                       | Bin 0 -> 4270683 bytes
 debian/data/refGene.txt.gz                         | Bin 0 -> 5340280 bytes
 ...deAwgTfbsBroadDnd41Ezh239875UniPk.narrowPeak.gz | Bin 0 -> 43400 bytes
 debian/patches/disable-doctests.patch              |  16 +++++
 debian/patches/offline-test-data.patch             |  66 +++++++++++++++++++++
 debian/patches/series                              |   3 +
 debian/patches/setup-cfg-deprecation.patch         |  19 ++++++
 debian/rules                                       |   3 +
 debian/source/include-binaries                     |   4 ++
 11 files changed, 116 insertions(+)

diff --git a/debian/data/README b/debian/data/README
new file mode 100644
index 0000000..2991e1c
--- /dev/null
+++ b/debian/data/README
@@ -0,0 +1,5 @@
+These data files originated from
+http://hgdownload.cse.ucsc.edu/goldenpath/hg19/database/
+
+where it says:
+"All the files and tables in this directory are freely usable for any purpose."
diff --git a/debian/data/ensGene.txt.gz b/debian/data/ensGene.txt.gz
new file mode 100644
index 0000000..6b505cf
Binary files /dev/null and b/debian/data/ensGene.txt.gz differ
diff --git a/debian/data/knownGene.txt.gz b/debian/data/knownGene.txt.gz
new file mode 100644
index 0000000..b809087
Binary files /dev/null and b/debian/data/knownGene.txt.gz differ
diff --git a/debian/data/refGene.txt.gz b/debian/data/refGene.txt.gz
new file mode 100644
index 0000000..d7c23ac
Binary files /dev/null and b/debian/data/refGene.txt.gz differ
diff --git a/debian/data/wgEncodeAwgTfbsBroadDnd41Ezh239875UniPk.narrowPeak.gz b/debian/data/wgEncodeAwgTfbsBroadDnd41Ezh239875UniPk.narrowPeak.gz
new file mode 100644
index 0000000..308970e
Binary files /dev/null and b/debian/data/wgEncodeAwgTfbsBroadDnd41Ezh239875UniPk.narrowPeak.gz differ
diff --git a/debian/patches/disable-doctests.patch b/debian/patches/disable-doctests.patch
new file mode 100644
index 0000000..40056b4
--- /dev/null
+++ b/debian/patches/disable-doctests.patch
@@ -0,0 +1,16 @@
+Description: Disable doctests
+ They require network access or patching to use existing data files
+Author: Afif Elghraoui <afif at debian.org>
+Forwarded: not-needed
+Last-Update: 2016-12-10
+--- python-intervaltree-bio.orig/setup.cfg
++++ python-intervaltree-bio/setup.cfg
+@@ -3,7 +3,7 @@
+ tag_svn_revision = false
+ 
+ [pytest]
+-addopts = --ignore=setup.py --ignore=build --ignore=dist --doctest-modules
++addopts = --ignore=setup.py --ignore=build --ignore=dist
+ norecursedirs=*.egg
+ 
+ 
diff --git a/debian/patches/offline-test-data.patch b/debian/patches/offline-test-data.patch
new file mode 100644
index 0000000..d48d72a
--- /dev/null
+++ b/debian/patches/offline-test-data.patch
@@ -0,0 +1,66 @@
+Description: Allow tests to be run using pre-downloaded data files
+ allow passing --datadir to pytest to use local data files without
+ attempting a download.
+Author: Afif Elghraoui <afif at debian.org>
+Forwarded: https://github.com/konstantint/intervaltree-bio/pull/2
+Last-Update: 2016-12-10
+--- python-intervaltree-bio.orig/tests/genomeintervaltree_test.py
++++ python-intervaltree-bio/tests/genomeintervaltree_test.py
+@@ -13,11 +13,9 @@
+ 
+ from intervaltree_bio import GenomeIntervalTree, UCSCTable
+ 
+-def test_knownGene():
++def test_knownGene(base_url):
+     # To speed up testing, we'll download the file and reuse the downloaded copy
+-    knownGene_url = 'http://hgdownload.cse.ucsc.edu/goldenpath/hg19/database/knownGene.txt.gz'
+-    # Mirror. Slightly faster and more stable, I believe:
+-    knownGene_url = 'http://kt.era.ee/distribute/pyintervaltree/knownGene.txt.gz'
++    knownGene_url = base_url + 'knownGene.txt.gz'
+ 
+     # To speed up testing, we'll download the file and reuse the downloaded copy
+     knownGene_file, headers = urlretrieve(knownGene_url)
+@@ -39,16 +37,14 @@
+     assert len(result) == 3
+     assert result[0].data == result[1].data and result[0].data == result[2].data
+     
+-def test_ensGene():
++def test_ensGene(base_url):
+     # Smoke-test we can at least read ensGene.
+-    ensGene_url = 'http://hgdownload.cse.ucsc.edu/goldenpath/hg19/database/ensGene.txt.gz'
+-    ensGene_url = 'http://kt.era.ee/distribute/pyintervaltree/ensGene.txt.gz'
++    ensGene_url = base_url + 'ensGene.txt.gz'
+     ensGene = GenomeIntervalTree.from_table(url=ensGene_url, mode='cds', parser=UCSCTable.ENS_GENE)
+     assert len(ensGene) == 204940
+ 
+-def test_refGene():
++def test_refGene(base_url):
+     # Smoke-test for refGene
+-    refGene_url = 'http://hgdownload.cse.ucsc.edu/goldenpath/hg19/database/refGene.txt.gz'
+-    refGene_url = 'http://kt.era.ee/distribute/pyintervaltree/refGene.txt.gz'
++    refGene_url = base_url + 'refGene.txt.gz'
+     refGene = GenomeIntervalTree.from_table(url=refGene_url, mode='tx', parser=UCSCTable.REF_GENE)
+     assert len(refGene) == 52350  # NB: Some time ago it was 50919, hence it seems the table data changes on UCSC and eventually the mirror and UCSC won't be the same.
+--- /dev/null
++++ python-intervaltree-bio/conftest.py
+@@ -0,0 +1,20 @@
++import os
++
++import pytest
++
++def pytest_addoption(parser):
++    parser.addoption("--datadir",
++                     help="path to data files")
++
++def pytest_generate_tests(metafunc):
++    if 'base_url' in metafunc.fixturenames:
++        if metafunc.config.option.datadir:
++            base_url = ('file://'
++                        + os.path.abspath(metafunc.config.option.datadir)
++                        + os.sep)
++        else:
++            base_url = 'http://hgdownload.cse.ucsc.edu/goldenpath/hg19/database/'
++            # Mirror. Slightly faster and more stable, I believe -KT
++
++            base_url = 'http://kt.era.ee/distribute/pyintervaltree/'
++        metafunc.parametrize('base_url',[base_url])
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..0e16617
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+offline-test-data.patch
+disable-doctests.patch
+setup-cfg-deprecation.patch
diff --git a/debian/patches/setup-cfg-deprecation.patch b/debian/patches/setup-cfg-deprecation.patch
new file mode 100644
index 0000000..98261ba
--- /dev/null
+++ b/debian/patches/setup-cfg-deprecation.patch
@@ -0,0 +1,19 @@
+Description: Update pytest setup.cfg entry
+ Address this warning:
+ ============================ pytest-warning summary ============================
+ WC1 None [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.
+ ================= 4 passed, 1 pytest-warnings in 83.34 seconds =================
+Author: Afif Elghraoui <afif at debian.org>
+Forwarded: https://github.com/konstantint/intervaltree-bio/pull/3
+Last-Update: 2016-12-10
+--- python-intervaltree-bio.orig/setup.cfg
++++ python-intervaltree-bio/setup.cfg
+@@ -2,7 +2,7 @@
+ tag_build = 
+ tag_svn_revision = false
+ 
+-[pytest]
++[tool:pytest]
+ addopts = --ignore=setup.py --ignore=build --ignore=dist
+ norecursedirs=*.egg
+ 
diff --git a/debian/rules b/debian/rules
index 2297e42..8f87d72 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,3 +9,6 @@ export PYBUILD_NAME=intervaltree-bio
 
 %:
 	dh $@ --with python2,python3 --buildsystem=pybuild
+
+override_dh_auto_test:
+	dh_auto_test -- --test-args "--verbose --datadir $(CURDIR)/debian/data"
diff --git a/debian/source/include-binaries b/debian/source/include-binaries
new file mode 100644
index 0000000..17bad67
--- /dev/null
+++ b/debian/source/include-binaries
@@ -0,0 +1,4 @@
+debian/data/ensGene.txt.gz
+debian/data/knownGene.txt.gz
+debian/data/refGene.txt.gz
+debian/data/wgEncodeAwgTfbsBroadDnd41Ezh239875UniPk.narrowPeak.gz

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-intervaltree-bio.git



More information about the debian-med-commit mailing list