add test for VersionPreference.BRANCH

This commit is contained in:
schnusch 2022-01-19 02:11:05 +01:00
parent e96a0baace
commit 56b583e67c
2 changed files with 413 additions and 0 deletions

385
tests/test_branch.atom Normal file
View File

@ -0,0 +1,385 @@
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
<id>tag:github.com,2008:/Mic92/nix-update/commits/master</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commits/master"/>
<link type="application/atom+xml" rel="self" href="https://github.com/Mic92/nix-update/commits/master.atom"/>
<title>Recent Commits to nix-update:master</title>
<updated>2021-12-13T14:02:42Z</updated>
<entry>
<id>tag:github.com,2008:Grit::Commit/79dcae59a9d16ec003bda4e232319db2fb83e252</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/79dcae59a9d16ec003bda4e232319db2fb83e252"/>
<title>
Merge pull request #74 from Mic92/mypy-fix
</title>
<updated>2021-12-13T14:02:42Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Merge pull request #74 from Mic92/mypy-fix
fix mypy&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/8e88950e6cab1f2b5e7be759b14e21cef7e6615d</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/8e88950e6cab1f2b5e7be759b14e21cef7e6615d"/>
<title>
fix mypy
</title>
<updated>2021-12-13T14:00:12Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;fix mypy&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/4692eb3a5cd27cc0cbce2cafe013271b62c8ec03</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/4692eb3a5cd27cc0cbce2cafe013271b62c8ec03"/>
<title>
Merge pull request #72 from Mic92/dependabot/github_actions/cachix/in…
</title>
<updated>2021-11-22T07:01:11Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Merge pull request #72 from Mic92/dependabot/github_actions/cachix/install-nix-action-16
Bump cachix/install-nix-action from 15 to 16&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/4efc9f1f37f555b326cfb722572506a099c71e53</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/4efc9f1f37f555b326cfb722572506a099c71e53"/>
<title>
Bump cachix/install-nix-action from 15 to 16
</title>
<updated>2021-11-22T06:01:34Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/in/29110?s=30&amp;v=4"/>
<author>
<name>dependabot</name>
<uri>https://github.com/dependabot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Bump cachix/install-nix-action from 15 to 16
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 15 to 16.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v15...v16)
---
updated-dependencies:
- dependency-name: cachix/install-nix-action
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] &amp;lt;support@github.com&amp;gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/b668fe6ea0b3d8464a1ede78d7306f309a6fb7f6</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/b668fe6ea0b3d8464a1ede78d7306f309a6fb7f6"/>
<title>
Merge pull request #70 from Mic92/ci
</title>
<updated>2021-11-15T07:45:54Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Merge pull request #70 from Mic92/ci
drop install_url&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/079aac11c75d03e534e948a5f8cfa2bb6f5ffd52</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/079aac11c75d03e534e948a5f8cfa2bb6f5ffd52"/>
<title>
drop install_url
</title>
<updated>2021-11-15T07:40:32Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;drop install_url&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/a494f951a76c77c796dd739ce18717a989a9ec2c</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/a494f951a76c77c796dd739ce18717a989a9ec2c"/>
<title>
Merge pull request #69 from Mic92/dependabot/github_actions/cachix/in…
</title>
<updated>2021-11-15T07:39:58Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Merge pull request #69 from Mic92/dependabot/github_actions/cachix/install-nix-action-15
Bump cachix/install-nix-action from 14 to 15&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/543030454c3e65e10b4ce6dc18f2f0f3b65c5484</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/543030454c3e65e10b4ce6dc18f2f0f3b65c5484"/>
<title>
Bump cachix/install-nix-action from 14 to 15
</title>
<updated>2021-11-15T06:00:49Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/in/29110?s=30&amp;v=4"/>
<author>
<name>dependabot</name>
<uri>https://github.com/dependabot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Bump cachix/install-nix-action from 14 to 15
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 14 to 15.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v14...v15)
---
updated-dependencies:
- dependency-name: cachix/install-nix-action
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] &amp;lt;support@github.com&amp;gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/52582817e8c6474c23b2855aa4bed2b53e708741</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/52582817e8c6474c23b2855aa4bed2b53e708741"/>
<title>
Merge pull request #67 from Mic92/dependabot/github_actions/cachix/in…
</title>
<updated>2021-09-13T11:29:28Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Merge pull request #67 from Mic92/dependabot/github_actions/cachix/install-nix-action-14
Bump cachix/install-nix-action from 13 to 14&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/72527c376744fb03f9558b7bb7b4195b082268d8</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/72527c376744fb03f9558b7bb7b4195b082268d8"/>
<title>
Bump cachix/install-nix-action from 13 to 14
</title>
<updated>2021-09-13T06:00:54Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/in/29110?s=30&amp;v=4"/>
<author>
<name>dependabot</name>
<uri>https://github.com/dependabot</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Bump cachix/install-nix-action from 13 to 14
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 13 to 14.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v13...v14)
---
updated-dependencies:
- dependency-name: cachix/install-nix-action
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] &amp;lt;support@github.com&amp;gt;&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/70bdf762e5be36ddea70234daa0d476fea0498ff</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/70bdf762e5be36ddea70234daa0d476fea0498ff"/>
<title>
README: migrate from restructured text
</title>
<updated>2021-09-02T04:57:00Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;README: migrate from restructured text&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/b167cc623191bc8bb1afbc7f3ab5ac0a039f70dd</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/b167cc623191bc8bb1afbc7f3ab5ac0a039f70dd"/>
<title>
Merge pull request #65 from Mic92/cargo-sha256
</title>
<updated>2021-08-26T13:48:04Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Merge pull request #65 from Mic92/cargo-sha256
allow to upload cargo checksum when source is local&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/2f498d50d7d70217557804907244062cb35a9e6b</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/2f498d50d7d70217557804907244062cb35a9e6b"/>
<title>
don&#39;t require valid version if --version=skip
</title>
<updated>2021-08-26T13:45:05Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;don&amp;#39;t require valid version if --version=skip&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/008e69ed04e4ff2bc962bb2b5c1e04bb3c725cb5</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/008e69ed04e4ff2bc962bb2b5c1e04bb3c725cb5"/>
<title>
allow to upload cargo checksum when source is local
</title>
<updated>2021-08-26T11:08:18Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;allow to upload cargo checksum when source is local&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/474e358eeab1dbeabddd0a16ecf647695e90f43b</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/474e358eeab1dbeabddd0a16ecf647695e90f43b"/>
<title>
Merge pull request #63 from Mic92/nixos-tests
</title>
<updated>2021-08-21T12:58:05Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Merge pull request #63 from Mic92/nixos-tests
fix evaluation on macos for pkgs with tests&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/bec42b219b9d4dfe6cef6abd5e71b4753996e00a</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/bec42b219b9d4dfe6cef6abd5e71b4753996e00a"/>
<title>
fix evaluation on macos for pkgs with tests
</title>
<updated>2021-08-21T08:33:02Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;fix evaluation on macos for pkgs with tests
fixes https://github.com/Mic92/nix-update/issues/62&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/3c77336eecf836c34b866271a58f74f1dc2a524d</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/3c77336eecf836c34b866271a58f74f1dc2a524d"/>
<title>
Merge pull request #60 from SuperSandro2000/sourcehut
</title>
<updated>2021-08-15T22:27:59Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/96200?s=30&amp;u=9ed15c85825694d00e996d605d728179b830c4fa&amp;v=4"/>
<author>
<name>Mic92</name>
<uri>https://github.com/Mic92</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Merge pull request #60 from SuperSandro2000/sourcehut
Add sourcehut support, minor cleanups&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/3ece737ad749ca480072921f145ca1b7d9da5498</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/3ece737ad749ca480072921f145ca1b7d9da5498"/>
<title>
Fix tests
</title>
<updated>2021-08-15T22:23:35Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/7258858?s=30&amp;u=c524720e2844ffa8a2aa67944fde5af54031e06d&amp;v=4"/>
<author>
<name>SuperSandro2000</name>
<uri>https://github.com/SuperSandro2000</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Fix tests&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/45fef9987cc850c36a8ed2bca0177f44b267f095</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/45fef9987cc850c36a8ed2bca0177f44b267f095"/>
<title>
Add lorri files to run tests
</title>
<updated>2021-08-15T22:23:35Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/7258858?s=30&amp;u=c524720e2844ffa8a2aa67944fde5af54031e06d&amp;v=4"/>
<author>
<name>SuperSandro2000</name>
<uri>https://github.com/SuperSandro2000</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Add lorri files to run tests&lt;/pre&gt;
</content>
</entry>
<entry>
<id>tag:github.com,2008:Grit::Commit/6ae3eb12864a4d5945f21a870ca4c97208a3a325</id>
<link type="text/html" rel="alternate" href="https://github.com/Mic92/nix-update/commit/6ae3eb12864a4d5945f21a870ca4c97208a3a325"/>
<title>
Remove unused import
</title>
<updated>2021-08-15T15:09:09Z</updated>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/7258858?s=30&amp;u=c524720e2844ffa8a2aa67944fde5af54031e06d&amp;v=4"/>
<author>
<name>SuperSandro2000</name>
<uri>https://github.com/SuperSandro2000</uri>
</author>
<content type="html">
&lt;pre style=&#39;white-space:pre-wrap;width:81ex&#39;&gt;Remove unused import&lt;/pre&gt;
</content>
</entry>
</feed>

28
tests/test_branch.py Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env python3
import unittest.mock
from pathlib import Path
from typing import BinaryIO
from nix_update.version import fetch_latest_version
from nix_update.version.version import VersionPreference
import conftest
TEST_ROOT = Path(__file__).parent.resolve()
def fake_urlopen(url: str) -> BinaryIO:
return open(TEST_ROOT.joinpath("test_branch.atom"), "rb")
def test_branch(helpers: conftest.Helpers) -> None:
with unittest.mock.patch("urllib.request.urlopen", fake_urlopen):
assert (
fetch_latest_version(
"https://github.com/Mic92/nix-update",
VersionPreference.BRANCH,
"(.*)",
"master",
).number
== "unstable-2021-12-13"
)