Commit e0904b33 authored by Vuillaume's avatar Vuillaume
Browse files

Merge branch 'fix_find_similar_recs' into 'master'

Fix find similar records

See merge request !219
parents 5e965aad c4b7805b
Pipeline #185025 failed with stages
in 2 minutes and 46 seconds
......@@ -4,8 +4,8 @@
"name": "eossr",
"description": "<p align=\"left\"><img src=\"docs/images/eossr_logo.png\" width=\"400px\" ></p><h1>The ESCAPE OSSR library</h1><p>The eOSSR Python library gathers all the developments made for the OSSR. In particular, it includes:- an API to programmatically access the OSSR, retrieve records and publish content- functions to map and crosswalk metadata between the CodeMeta schema adopted for the OSSR and Zenodo internal schema- functions to help developers automatically contribute to the OSSR, in particular using their continuous integration (see also code snippets)</p><p>Code: <a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr\">https://gitlab.in2p3.fr/escape2020/wp3/eossr</a>Documentation: <a href=\"https://escape2020.pages.in2p3.fr/wp3/eossr/\">https://escape2020.pages.in2p3.fr/wp3/eossr/</a></p><p><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/commits/master\"><img alt=\"\" src=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/badges/master/pipeline.svg\" /></a><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/commits/master\"><img alt=\"\" src=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/badges/master/coverage.svg\" /></a><a href=\"https://bestpractices.coreinfrastructure.org/projects/5712\"><img alt=\"CII Best Practices\" src=\"https://bestpractices.coreinfrastructure.org/projects/5712/badge\" /></a><a href=\"https://opensource.org/licenses/MIT\"><img alt=\"\" src=\"https://img.shields.io/badge/License-MIT-blue.svg\" /></a><a href=\"https://doi.org/10.5281/zenodo.5524912\"><img alt=\"\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5524912.svg\" /></a><a href=\"https://mybinder.org/v2/git/https%3A%2F%2Fgitlab.in2p3.fr%2Fescape2020%2Fwp3%2Feossr/HEAD\"><img alt=\"\" src=\"https://mybinder.org/badge_logo.svg\" /></a></p><h2>Former stable versions</h2><ul><li>v0.6: <a href=\"https://doi.org/10.5281/zenodo.6475946\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.6475946.svg\" /></a></li><li>v0.5: <a href=\"https://doi.org/10.5281/zenodo.6352039\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.6352039.svg\" /></a></li><li>v0.4: <a href=\"https://doi.org/10.5281/zenodo.6326454\"><img alt=\"DOI\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.6326454.svg\" /></a></li><li>v0.3.3: <a href=\"https://doi.org/10.5281/zenodo.5592584\"><img alt=\"\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5592584.svg\" /></a></li><li>v0.2 : <a href=\"https://doi.org/10.5281/zenodo.5524913\"><img alt=\"\" src=\"https://zenodo.org/badge/DOI/10.5281/zenodo.5524913.svg\" /></a></li></ul><h2>Install</h2><p>Commands to be run in your terminal.</p><h3>For users</h3><pre><code>pip install eossr</code></pre><p>You can also run it with docker:</p><pre><code>docker run -it gitlab-registry.in2p3.fr/escape2020/wp3/eossr:latest</code></pre><p><a href=\"https://gitlab.in2p3.fr/escape2020/wp3/eossr/container_registry\">Visit our registry</a> to see the available docker containers.</p><p>Note that <code>latest</code> tag always point to the latest stable released container.</p><h3>For developers</h3><pre><code>git clone https://gitlab.in2p3.fr/escape2020/wp3/eossr.gitpip install -e &quot;./eossr&quot;</code></pre><h4>Running tests</h4><p>To run tests locally, run:</p><pre><code>pip install -e &quot;./eossr[tests]&quot;pytest eossr</code></pre><p>Some tests will be skiped if <code>SANDBOX_ZENODO_TOKEN</code> is not defined in your environment variables.If you want to run these tests, you will need to create a <a href=\"https://sandbox.zenodo.org/account/settings/applications/tokens/new/\">sandbox zenodo token</a> and add it to your env:</p><pre><code>export SANDBOX_ZENODO_TOKEN=&quot;your_sandbox_token&quot;</code></pre><h2>License</h2><p>See <a href=\"LICENSE\">LICENSE</a></p><h2>Cite</h2><p>To cite this library, use the cite section in <a href=\"https://zenodo.org/record/5592584#.YiALJRPMI-Q\">the Zenodo page</a> (rightcolumn, below the <code>Versions</code> section).</p>",
"license": "https://spdx.org/licenses/MIT",
"version": "v0.7.dev35+g7d27987",
"softwareVersion": "v0.7.dev35+g7d27987",
"version": "v0.7.dev34+g7755847",
"softwareVersion": "v0.7.dev34+g7755847",
"codeRepository": "https://gitlab.in2p3.fr/escape2020/wp3/eossr",
"developmentStatus": "active",
"isAccessibleForFree": true,
......@@ -43,11 +43,11 @@
"zenodo"
],
"runtimePlatform": "Python 3",
"downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev35+g7d27987/eossr-v0.7.dev35+g7d27987.zip",
"downloadUrl": "https://gitlab.in2p3.fr/escape2020/wp3/eossr/-/archive/v0.7.dev34+g7755847/eossr-v0.7.dev34+g7755847.zip",
"releaseNotes": "",
"dateCreated": "2021-08-31",
"datePublished": "2022-06-29",
"dateModified": "2022-06-29",
"datePublished": "2022-06-30",
"dateModified": "2022-06-30",
"operatingSystem": "",
"maintainer": {
"@type": "Person",
......
......@@ -63,7 +63,7 @@ class TestZenodoAPINoToken(unittest.TestCase):
@pytest.mark.skipif(os.getenv('SANDBOX_ZENODO_TOKEN') is None, reason="SANDBOX_ZENODO_TOKEN not defined")
class TestZenodoAPIToken(unittest.TestCase):
class TestZenodoAPITokenSandbox(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestZenodoAPIToken, self).__init__(*args, **kwargs)
self.token = os.getenv('SANDBOX_ZENODO_TOKEN')
......@@ -107,13 +107,6 @@ class TestZenodoAPIToken(unittest.TestCase):
self.zenodo.erase_entry(new_record_id)
print(f"{new_record_id} created and deleted")
def test_find_similar_records_sandbox(self):
self.zenodo.parameters.update({'size': 100})
existing_record = Record.from_id(939075, sandbox=True) # One of the copies of eossr
assert len(self.zenodo.find_similar_records(existing_record)) > 0
not_existing_record = Record.from_id(767507, sandbox=True) # Sandbox E.GARCIA ZenodoCI_vTest Records
assert self.zenodo.find_similar_records(not_existing_record) == []
@pytest.mark.skipif(
os.getenv('SANDBOX_ZENODO_TOKEN_GARCIA') is None, reason="SANDBOX_ZENODO_TOKEN_GARCIA not defined"
)
......@@ -150,6 +143,21 @@ class TestZenodoAPIToken(unittest.TestCase):
assert 532458 in records_ids # pending request in escape2020 sandbox community - 2021-11-28
@pytest.mark.skipif(os.getenv('ZENODO_TOKEN') is None, reason="ZENODO_TOKEN not defined")
class TestZenodoAPIToken(unittest.TestCase):
def __init__(self, *args, **kwargs):
super(TestZenodoAPIToken, self).__init__(*args, **kwargs)
self.token = os.getenv('ZENODO_TOKEN')
self.zenodo = ZenodoAPI(access_token=self.token, sandbox=False)
def test_find_similar_records_sandbox(self):
self.zenodo.parameters.update({'size': 100})
existing_record = Record.from_id(939075, sandbox=True) # One of the copies of eossr
assert len(self.zenodo.find_similar_records(existing_record)) > 0
not_existing_record = Record.from_id(767507, sandbox=True) # Sandbox E.GARCIA ZenodoCI_vTest Records
assert self.zenodo.find_similar_records(not_existing_record) == []
def test_get_zenodo_records():
zenodo_records = get_zenodo_records('ESCAPE template project', all_versions=True)
assert len(zenodo_records) > 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment