Skip to content

Commit

Permalink
A few improvements (#210)
Browse files Browse the repository at this point in the history
* Added support for -k option used for testing

* Removed vofs

* Removed 2.7 code

* Added support for server versions
  • Loading branch information
Adrian committed Dec 19, 2022
1 parent d32c85c commit c79f527
Show file tree
Hide file tree
Showing 35 changed files with 1,897 additions and 114 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: "3.10"
- name: Install tox
run: python -m pip install --upgrade tox
- name: egg-info vos
Expand All @@ -28,8 +28,7 @@ jobs:
strategy:
fail-fast: true
matrix:
#TODO 2.7 fails on GH Actions but cannot be reproduced locally. Disabled for now.
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
package: [vos]
steps:
- name: Checkout code
Expand All @@ -55,10 +54,10 @@ jobs:
needs: tests
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: "3.10"
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- name: Install tox
Expand Down
2 changes: 1 addition & 1 deletion vos/intTest/test_basic_cmds.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from vos.commands import vls, vcp, vmkdir, vrm, vrmdir, vchmod, vmv, vln, vsync
from vos.commands import vtag, vlock
from six import StringIO
from io import StringIO
from cadcutils import net
from mock import patch, Mock
import pytest
Expand Down
6 changes: 2 additions & 4 deletions vos/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,17 @@ edit_on_github = False
github_project = opencadc/vostools
install_requires =
html2text>=2016.5.29
cadcutils>=1.4.3
future
cadcutils>=1.5.1
aenum

# version should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440)
version = 3.3.7
version = 3.4

[options.extras_require]
test =
pytest>=4.6
pytest-cov>=2.5.1
flake8>=3.4.1
future>=0.16.0
mock>=2.0.0


Expand Down
1 change: 0 additions & 1 deletion vos/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def run_tests(self):
long_description=readme(),
project_urls={
'Source': 'https://github.com/opencadc/vostools',
'Travis CI': 'https://travis-ci.org/opencadc/vostools',
'Issues': 'https://github.com/opencadc/vostools/issues',
'VOSpace Standard': 'http://www.ivoa.net/documents/VOSpace/'
},
Expand Down
81 changes: 74 additions & 7 deletions vos/test/performance/vofsRandomAccessSeeks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,71 @@
#!/usr/bin/env python2.7
# ***********************************************************************
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
# All rights reserved Tous droits réservés
#
# NRC disclaims any warranties, Le CNRC dénie toute garantie
# expressed, implied, or énoncée, implicite ou légale,
# statutory, of any kind with de quelque nature que ce
# respect to the software, soit, concernant le logiciel,
# including without limitation y compris sans restriction
# any warranty of merchantability toute garantie de valeur
# or fitness for a particular marchande ou de pertinence
# purpose. NRC shall not be pour un usage particulier.
# liable in any event for any Le CNRC ne pourra en aucun cas
# damages, whether direct or être tenu responsable de tout
# indirect, special or general, dommage, direct ou indirect,
# consequential or incidental, particulier ou général,
# arising from the use of the accessoire ou fortuit, résultant
# software. Neither the name de l'utilisation du logiciel. Ni
# of the National Research le nom du Conseil National de
# Council of Canada nor the Recherches du Canada ni les noms
# names of its contributors may de ses participants ne peuvent
# be used to endorse or promote être utilisés pour approuver ou
# products derived from this promouvoir les produits dérivés
# software without specific prior de ce logiciel sans autorisation
# written permission. préalable et particulière
# par écrit.
#
# This file is part of the Ce fichier fait partie du projet
# OpenCADC project. OpenCADC.
#
# OpenCADC is free software: OpenCADC est un logiciel libre ;
# you can redistribute it and/or vous pouvez le redistribuer ou le
# modify it under the terms of modifier suivant les termes de
# the GNU Affero General Public la “GNU Affero General Public
# License as published by the License” telle que publiée
# Free Software Foundation, par la Free Software Foundation
# either version 3 of the : soit la version 3 de cette
# License, or (at your option) licence, soit (à votre gré)
# any later version. toute version ultérieure.
#
# OpenCADC is distributed in the OpenCADC est distribué
# hope that it will be useful, dans l’espoir qu’il vous
# but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE
# without even the implied GARANTIE : sans même la garantie
# warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ
# or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF
# PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence
# General Public License for Générale Publique GNU Affero
# more details. pour plus de détails.
#
# You should have received Vous devriez avoir reçu une
# a copy of the GNU Affero copie de la Licence Générale
# General Public License along Publique GNU Affero avec
# with OpenCADC. If not, see OpenCADC ; si ce n’est
# <http://www.gnu.org/licenses/>. pas le cas, consultez :
# <http://www.gnu.org/licenses/>.
#
# $Revision: 4 $
#
# ***********************************************************************
#


import os
import optparse
Expand All @@ -21,7 +88,7 @@ def parseCmdLine():
help='File to read.' )
Main.opt, args = op.parse_args()
if ( Main.opt.fileName == '-' ):
print "ERROR: Filename must be provided."
print("ERROR: Filename must be provided.")
op.print_help()
exit( -1 )

Expand All @@ -30,12 +97,12 @@ def parseCmdLine():
statinfo = os.stat(Main.opt.fileName)
maxValue = ( statinfo.st_size / 1024 ) - Main.opt.size
Main.opt.offsets = " ".join( str(w) for w in \
random.sample( xrange(maxValue), Main.opt.random) )
print Main.opt.offsets
random.sample( range(maxValue), Main.opt.random) )
print(Main.opt.offsets)
else:
for offset in Main.opt.offsets.split():
if ( not offset.isdigit() ):
print "ERROR: Offsets must be integers"
print("ERROR: Offsets must be integers")
op.print_help()
exit( -1 )

Expand Down Expand Up @@ -66,7 +133,7 @@ def mainMethod():
timming.append( end - start )

for atime in timming:
print "{0} ".format( int( atime * 1000000 ) ),
print
print("{0} ".format( int( atime * 1000000 ) )),
print('')

Main.mainMethod()
78 changes: 72 additions & 6 deletions vos/test/scripts/test_lockerrors_int.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,70 @@
#!/usr/bin/env python2.7
# ***********************************************************************
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
# All rights reserved Tous droits réservés
#
# NRC disclaims any warranties, Le CNRC dénie toute garantie
# expressed, implied, or énoncée, implicite ou légale,
# statutory, of any kind with de quelque nature que ce
# respect to the software, soit, concernant le logiciel,
# including without limitation y compris sans restriction
# any warranty of merchantability toute garantie de valeur
# or fitness for a particular marchande ou de pertinence
# purpose. NRC shall not be pour un usage particulier.
# liable in any event for any Le CNRC ne pourra en aucun cas
# damages, whether direct or être tenu responsable de tout
# indirect, special or general, dommage, direct ou indirect,
# consequential or incidental, particulier ou général,
# arising from the use of the accessoire ou fortuit, résultant
# software. Neither the name de l'utilisation du logiciel. Ni
# of the National Research le nom du Conseil National de
# Council of Canada nor the Recherches du Canada ni les noms
# names of its contributors may de ses participants ne peuvent
# be used to endorse or promote être utilisés pour approuver ou
# products derived from this promouvoir les produits dérivés
# software without specific prior de ce logiciel sans autorisation
# written permission. préalable et particulière
# par écrit.
#
# This file is part of the Ce fichier fait partie du projet
# OpenCADC project. OpenCADC.
#
# OpenCADC is free software: OpenCADC est un logiciel libre ;
# you can redistribute it and/or vous pouvez le redistribuer ou le
# modify it under the terms of modifier suivant les termes de
# the GNU Affero General Public la “GNU Affero General Public
# License as published by the License” telle que publiée
# Free Software Foundation, par la Free Software Foundation
# either version 3 of the : soit la version 3 de cette
# License, or (at your option) licence, soit (à votre gré)
# any later version. toute version ultérieure.
#
# OpenCADC is distributed in the OpenCADC est distribué
# hope that it will be useful, dans l’espoir qu’il vous
# but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE
# without even the implied GARANTIE : sans même la garantie
# warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ
# or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF
# PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence
# General Public License for Générale Publique GNU Affero
# more details. pour plus de détails.
#
# You should have received Vous devriez avoir reçu une
# a copy of the GNU Affero copie de la Licence Générale
# General Public License along Publique GNU Affero avec
# with OpenCADC. If not, see OpenCADC ; si ce n’est
# <http://www.gnu.org/licenses/>. pas le cas, consultez :
# <http://www.gnu.org/licenses/>.
#
# $Revision: 4 $
#
# ***********************************************************************
#

"""Integration test wrapped in unit test infrastructure.
Expects vospace_ws to be running on localhost, and
Expand Down Expand Up @@ -42,21 +108,21 @@ def run_cmd(self, args, print_output=False, use_debug=False, expected_errno=255,

cmd = '%s %s %s %s %s' %(self.time_execution, self.script_run, args, self.use_debug, self.test_cert_param)
if print_output:
print 'Running [%s]' % cmd
print('Running [%s]' % cmd)

try:
p = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
output = p.communicate()[0]
if print_output:
print output
print(output)

self.assertEquals(p.returncode, expected_errno, 'got returncode %d, expected %d' % (p.returncode, expected_errno))
regex = re.search('NodeLocked', output)
self.assertTrue(regex != None, 'did not find "NodeLocked"' )

except Exception, e:
print 'Error running [%s]' % cmd
print output
except Exception as e:
print('Error running [%s]' % cmd)
print(output)
self.fail(e)


Expand Down
2 changes: 1 addition & 1 deletion vos/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = vos

[tox]
envlist =
py{27,34,35,36,37,38,39}
py{37,38,39,310,311}
requires =
pip >= 19.3.1

Expand Down
68 changes: 68 additions & 0 deletions vos/vos/commands/interrupt_exception.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,71 @@
# ***********************************************************************
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2022. (c) 2022.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
# All rights reserved Tous droits réservés
#
# NRC disclaims any warranties, Le CNRC dénie toute garantie
# expressed, implied, or énoncée, implicite ou légale,
# statutory, of any kind with de quelque nature que ce
# respect to the software, soit, concernant le logiciel,
# including without limitation y compris sans restriction
# any warranty of merchantability toute garantie de valeur
# or fitness for a particular marchande ou de pertinence
# purpose. NRC shall not be pour un usage particulier.
# liable in any event for any Le CNRC ne pourra en aucun cas
# damages, whether direct or être tenu responsable de tout
# indirect, special or general, dommage, direct ou indirect,
# consequential or incidental, particulier ou général,
# arising from the use of the accessoire ou fortuit, résultant
# software. Neither the name de l'utilisation du logiciel. Ni
# of the National Research le nom du Conseil National de
# Council of Canada nor the Recherches du Canada ni les noms
# names of its contributors may de ses participants ne peuvent
# be used to endorse or promote être utilisés pour approuver ou
# products derived from this promouvoir les produits dérivés
# software without specific prior de ce logiciel sans autorisation
# written permission. préalable et particulière
# par écrit.
#
# This file is part of the Ce fichier fait partie du projet
# OpenCADC project. OpenCADC.
#
# OpenCADC is free software: OpenCADC est un logiciel libre ;
# you can redistribute it and/or vous pouvez le redistribuer ou le
# modify it under the terms of modifier suivant les termes de
# the GNU Affero General Public la “GNU Affero General Public
# License as published by the License” telle que publiée
# Free Software Foundation, par la Free Software Foundation
# either version 3 of the : soit la version 3 de cette
# License, or (at your option) licence, soit (à votre gré)
# any later version. toute version ultérieure.
#
# OpenCADC is distributed in the OpenCADC est distribué
# hope that it will be useful, dans l’espoir qu’il vous
# but WITHOUT ANY WARRANTY; sera utile, mais SANS AUCUNE
# without even the implied GARANTIE : sans même la garantie
# warranty of MERCHANTABILITY implicite de COMMERCIALISABILITÉ
# or FITNESS FOR A PARTICULAR ni d’ADÉQUATION À UN OBJECTIF
# PURPOSE. See the GNU Affero PARTICULIER. Consultez la Licence
# General Public License for Générale Publique GNU Affero
# more details. pour plus de détails.
#
# You should have received Vous devriez avoir reçu une
# a copy of the GNU Affero copie de la Licence Générale
# General Public License along Publique GNU Affero avec
# with OpenCADC. If not, see OpenCADC ; si ce n’est
# <http://www.gnu.org/licenses/>. pas le cas, consultez :
# <http://www.gnu.org/licenses/>.
#
# $Revision: 4 $
#
# ***********************************************************************
#

"""A utilities for dealing with CL signal handeling."""
import signal

Expand Down
Loading

0 comments on commit c79f527

Please sign in to comment.