nur-packages

My NUR packages
git clone git://git.sikmir.ru/nur-packages
Log | Files | Refs | README | LICENSE

commit 1c3ccc6a8527777a0b64021e515d4cc2db91bfb1
parent a5e7ca4c34ed32a884fc643eb1c5f9d8cf659782
Author: Nikolay Korotkiy <sikmir@gmail.com>
Date:   Sun, 12 Jul 2020 02:44:18 +0300

gpxelevations: fix tests

Diffstat:
Mpkgs/development/python-modules/gpxelevations/default.nix | 11++++++++++-
Apkgs/development/python-modules/gpxelevations/testdata.nix | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/pkgs/development/python-modules/gpxelevations/default.nix b/pkgs/development/python-modules/gpxelevations/default.nix @@ -1,8 +1,10 @@ -{ lib, python3Packages, sources }: +{ lib, python3Packages, fetchurl, sources }: let pname = "gpxelevations"; date = lib.substring 0 10 sources.gpxelevations.date; version = "unstable-" + date; + + testdata = import ./testdata.nix { inherit fetchurl; }; in python3Packages.buildPythonApplication { inherit pname version; @@ -10,6 +12,13 @@ python3Packages.buildPythonApplication { propagatedBuildInputs = with python3Packages; [ requests gpxpy ]; + postPatch = '' + mkdir -p tmp_home/.cache/srtm + ${lib.concatMapStringsSep "\n" (hgt: '' + cp ${hgt} tmp_home/.cache/srtm/${hgt.name} + '') testdata} + ''; + checkPhase = '' HOME=tmp_home ${python3Packages.python.interpreter} -m unittest test ''; diff --git a/pkgs/development/python-modules/gpxelevations/testdata.nix b/pkgs/development/python-modules/gpxelevations/testdata.nix @@ -0,0 +1,57 @@ +{ fetchurl }: +let + fetchSrtm = { file, sha256 }: fetchurl { + inherit sha256; + url = "https://dds.cr.usgs.gov/srtm/version2_1/SRTM3/${file}"; + }; +in +[ + (fetchSrtm { + file = "Eurasia/N47E013.hgt.zip"; + sha256 = "0b8r9z6ni6dzqjzrk848nwywk73079lzh39h676z23nf4f5303jl"; + }) + (fetchSrtm { + file = "Eurasia/N46E013.hgt.zip"; + sha256 = "14ipvzki7n6bgls0kg33id1587pzjhfm05ddqpgcniy8sq8lkdgg"; + }) + (fetchSrtm { + file = "Eurasia/N47E012.hgt.zip"; + sha256 = "0wk5sa9mxcjj9nkk29myxz4qayjrhp1xb1wkn7ij42kl0zz4568n"; + }) + (fetchSrtm { + file = "Africa/N00E015.hgt.zip"; + sha256 = "1v29x62fw4rxl32rbgmc19fczagvv8dld31razq3rimdh8x6jgja"; + }) + (fetchSrtm { + file = "Africa/S01E015.hgt.zip"; + sha256 = "0s54vmgd7dpy71cza2193m2615a3m4qh5rffza3g7myh5gz3kd4n"; + }) + (fetchSrtm { + file = "Eurasia/N51E000.hgt.zip"; + sha256 = "09frqq1qlgchbz08r0lpx4fxd04s848c8v7bpmvwl43hyrjml347"; + }) + (fetchSrtm { + file = "Eurasia/N51W001.hgt.zip"; + sha256 = "0p0kc9bghgik388ii86mabc8jdlmj567lpfbbjxpc6wqs1hmxjwp"; + }) + (fetchSrtm { + file = "Eurasia/N42E071.hgt.zip"; + sha256 = "0qxpg4vb77wk056jp6qj03cmrwp0bbzf1nxihdwwxbmyhrxn2zrq"; + }) + (fetchSrtm { + file = "Eurasia/N43E087.hgt.zip"; + sha256 = "0hbqjskgi4is4wa5frndlgaxi6cbmxrh0kfddwbcml18nyyfw4xh"; + }) + (fetchSrtm { + file = "Africa/N31E035.hgt.zip"; + sha256 = "0g20fzrlwmxzas3mdxlk0kf4nygxq5xl616ana9n4dg35m4ivva8"; + }) + (fetchSrtm { + file = "Eurasia/N55E055.hgt.zip"; + sha256 = "0nm4yhrjx4m396bp5nyj4nzv8gdgbj4cpddls2fx24bp880vv8r2"; + }) + (fetchSrtm { + file = "Eurasia/N45E013.hgt.zip"; + sha256 = "1f802rw7z8s29jjbk0j4gkbyg9jgknrzbg2lalcbvq55hj1j95nb"; + }) +]