Skip to content

Commit 43453fc

Browse files
committed
Update all dependencies and bump to 2.3.6
1 parent cdfd494 commit 43453fc

32 files changed

+120
-98
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ When unit tests are being run as part of CI or as a normal guard against regress
110110

111111
The normal procedure for writing a sample based unit test is to just write the test as if the sample already exists, then running the test with `--sample-ask` and viewing and approving the resulting sample, which is then automatically written to a file. The sample file name is displayed, making it easy to find the file in order to add it to tracking so that it can be committed along with the test module.
112112

113-
When working on large changes that cause many samples to become outdated, reviewing and approving samples can be deferred until the new code approaches stability. This is done by running the tests with `--sample-write`, which automatically writes or updates samples to match the current results. Then, running the tests with `--sample-review` before committing.
113+
When working on large changes that cause many samples to become outdated, reviewing and approving samples can be deferred until the new code approaches stability. This is done by running the tests with `--sample-write`, which automatically writes or updates samples to match the current results. Then, view and approve the tests with `--sample-review` before committing.
114114

115115
Typically, it is not desirable to track generated files in Git. However, although the sample files are generated, they are an integral part of the units tests, and should be tracked just like the unit tests themselves.
116116

117-
Also implemented is a simple process for cleaning out unused sample files. Sample files are often orphaned when their corresponding tests are removed or refactored. The default storage location for sample files is a directory called `test_docs`. To clean out unused files, move all the files from `test_docs` to `test_docs_tidy`, and run the tests. Any files that are accessed by the tests will automatically be moved back to `test_docs`, and any files remaining in `test_docs_tidy` after a complete test run can be untracked and deleted.
117+
Also implemented is a simple process for cleaning out unused sample files. Sample files are often orphaned when their corresponding tests are removed or refactored. The process is activated with the `--sample-tidy` switch. When active, the test session starts by moving all sample files from their default directory, `test_docs`, to `test_docs_tidy`. As the sample files are accessed by tests, they are automatically moved back to `test_docs`, and any files remaining in `test_docs_tidy` after a complete test run can be untracked and deleted.
118118

119119
When staging `test_docs`, stage the directory, so that new files are included, and deleted files get deleted on the server:
120120

121121
$ git add test_utilities/src/d1_test/test_docs
122-
$ git commit -m 'Update sample docs'
122+
$ git commit -m 'Update samples'
123123

124124
#### DataONE Client to Django test adapter
125125

@@ -226,7 +226,9 @@ Edit `~/.pypirc`:
226226

227227
### Creating a new release
228228

229-
The stack should pass all the tests with the most recent available versions of all the dependencies.
229+
#### Updating dependencies
230+
231+
Update all packages managed by pip:
230232

231233
$ cd d1_python
232234
$ sudo ./dev_tools/src/d1_dev/pip-update-all.py
@@ -244,10 +246,12 @@ Check that there are no package version conflicts:
244246

245247
Some sample files contain the version tag and must be updated when the version changes.
246248

247-
$ pytest --sample-ask
249+
$ pytest -xvs --sample-ask
248250

249251
Commit and push the changes, and check the build on Travis.
250252

253+
#### Building the release packages
254+
251255
After successful build, clone a fresh copy, which will be used for building the release packages:
252256

253257
$ cd ~

client_cli/src/setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
def main():
2929
setuptools.setup(
3030
name='dataone.cli',
31-
version='2.3.5',
31+
version='2.3.6',
3232
description='Command-Line Interface (CLI) for DataONE',
3333
author='DataONE Project',
3434
author_email='[email protected]',
@@ -37,10 +37,10 @@ def main():
3737
packages=setuptools.find_packages(),
3838
include_package_data=True,
3939
install_requires=[
40-
'dataone.common == 2.3.5',
41-
'dataone.libclient == 2.3.5',
40+
'dataone.common == 2.3.6',
41+
'dataone.libclient == 2.3.6',
4242
#
43-
'requests == 2.18.3',
43+
'requests == 2.18.4',
4444
],
4545
entry_points={'console_scripts': [
4646
'dataone = d1_cli.dataone:main',

client_onedrive/src/setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
def main():
3333
setuptools.setup(
3434
name='dataone.onedrive',
35-
version='2.3.5',
35+
version='2.3.6',
3636
description='Filesystem access to the DataONE Workspace',
3737
author='DataONE Project',
3838
author_email='[email protected]',
@@ -41,14 +41,14 @@ def main():
4141
packages=setuptools.find_packages(),
4242
include_package_data=True,
4343
install_requires=[
44-
'dataone.common == 2.3.5',
45-
'dataone.libclient == 2.3.5',
44+
'dataone.common == 2.3.6',
45+
'dataone.libclient == 2.3.6',
4646
#
4747
'fusepy == 2.0.4',
4848
'pyxb == 1.2.5',
4949
'pyzotero == 1.2.13',
5050
'rdflib == 4.2.2',
51-
'requests == 2.18.3',
51+
'requests == 2.18.4',
5252
],
5353
setup_requires=[
5454
'setuptools_git >= 1.1',

dev_tools/src/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
def main():
3030
setuptools.setup(
3131
name='dataone.dev',
32-
version='2.3.5',
32+
version='2.3.6',
3333
description='DataONE developer tools',
3434
author='DataONE Project',
3535
author_email='[email protected]',
@@ -50,7 +50,7 @@ def main():
5050
# asn1crypto and requests. Without this, if asn1crypto is installed first,
5151
# it will install idna 2.6, and requests will fails due to the fact that
5252
# Python doesn't have a real package manager.
53-
'idna == 2.5',
53+
'idna == 2.6',
5454
#
5555
'baron == 0.6.6',
5656
'pip == 9.0.1',

gmn/src/d1_gmn/app/views/slice.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
import copy
2424
import hashlib
25-
import logging
2625

2726
import d1_common.const
2827
import d1_common.types
@@ -33,21 +32,23 @@
3332
import django.core.cache
3433
import django.db.models
3534

35+
# import logging
36+
3637

3738
def add_slice_filter(request, query, total_int):
3839
url_dict = d1_common.url.parseUrl(request.get_full_path())
3940
query_dict = url_dict['query']
40-
logging.error(query_dict)
41+
# logging.debug(query_dict)
4142
start_int, count_int, total_int = (
4243
_convert_and_sanity_check_slice_params(query_dict, total_int)
4344
)
44-
logging.error(query_dict)
45-
logging.error(url_dict)
45+
# logging.debug(query_dict)
46+
# logging.debug(url_dict)
4647
authn_subj_set = _get_authenticated_subjects(request)
47-
logging.debug(
48-
'Adding slice filter. start={} count={} total={} subj={}'
49-
.format(start_int, count_int, total_int, ','.join(list(authn_subj_set)))
50-
)
48+
# logging.debug(
49+
# 'Adding slice filter. start={} count={} total={} subj={}'
50+
# .format(start_int, count_int, total_int, ','.join(list(authn_subj_set)))
51+
# )
5152
last_tup = _cache_get_last_in_slice(url_dict, authn_subj_set)
5253
if last_tup:
5354
query = _add_fast_slice_filter(query, last_tup, count_int)
@@ -70,7 +71,7 @@ def cache_add_last_in_slice(request, query, total_int, sort_field_list):
7071
else:
7172
last_tup = None
7273
django.core.cache.cache.set(key_str, last_tup)
73-
logging.debug('Cache set. key="{}" last={}'.format(key_str, last_tup))
74+
# logging.debug('Cache set. key="{}" last={}'.format(key_str, last_tup))
7475

7576

7677
#
@@ -128,9 +129,9 @@ def _get_authenticated_subjects(request):
128129

129130

130131
def _add_fast_slice_filter(query, last_tup, count_int):
131-
logging.debug(
132-
'Adding fast slice filter. last={} count={}'.format(last_tup, count_int)
133-
)
132+
# logging.debug(
133+
# 'Adding fast slice filter. last={} count={}'.format(last_tup, count_int)
134+
# )
134135
last_timestamp, last_id = last_tup
135136
return query.filter(
136137
django.db.models.Q(timestamp__lt=last_timestamp) |
@@ -145,10 +146,10 @@ def _add_fallback_slice_filter(query, url_dict):
145146
to run very slowly on large result sets.
146147
"""
147148
start_int, count_int, total_int = _get_slice_params(url_dict['query'])
148-
logging.debug(
149-
'Adding fallback slice filter. start={} count={}'.
150-
format(start_int, count_int)
151-
)
149+
# logging.debug(
150+
# 'Adding fallback slice filter. start={} count={}'.
151+
# format(start_int, count_int)
152+
# )
152153
if not start_int and not count_int:
153154
return query.none()
154155
else:
@@ -163,7 +164,7 @@ def _cache_get_last_in_slice(url_dict, authn_subj_set):
163164
last_tup = django.core.cache.cache.get(key_str)
164165
except KeyError:
165166
last_tup = None
166-
logging.debug('Cache get. key="{}" -> last_tup={}'.format(key_str, last_tup))
167+
# logging.debug('Cache get. key="{}" -> last_tup={}'.format(key_str, last_tup))
167168
return last_tup
168169

169170

@@ -191,7 +192,7 @@ def _gen_cache_key_for_slice(url_dict, authn_subj_set, result_record_count=0):
191192
hash of the JSON is used for better distribution in a hash map and to avoid
192193
the 256 bytes limit on keys in some caches.
193194
"""
194-
logging.debug('Gen key. result_record_count={}'.format(result_record_count))
195+
# logging.debug('Gen key. result_record_count={}'.format(result_record_count))
195196
key_url_dict = copy.deepcopy(url_dict)
196197
key_url_dict['query']['start'] += result_record_count
197198
del key_url_dict['query']['count']

gmn/src/d1_gmn/tests/gmn_test_case.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,33 +72,37 @@ class GMNTestCase(
7272
d1_test.d1_test_case.D1TestCase,
7373
):
7474
def setup_class(self):
75+
"""Run for each test class that derives from GMNTestCase"""
7576
if ENABLE_SQL_PROFILING:
7677
connection.queries = []
7778

7879
def teardown_class(self):
80+
"""Run for each test class that derives from GMNTestCase"""
7981
GMNTestCase.capture_exception()
8082
if ENABLE_SQL_PROFILING:
81-
logging.debug('SQL queries by all methods:')
82-
map(logging.debug, connection.queries)
83+
logging.info('SQL queries by all methods:')
84+
map(logging.info, connection.queries)
8385

8486
def setup_method(self, method):
87+
"""Run for each test method that derivces from GMNTestCase"""
88+
# logging.error('GMNTestCase.setup_method()')
8589
d1_test.mock_api.django_client.add_callback(
8690
d1_test.d1_test_case.MOCK_BASE_URL
8791
)
88-
d1_test.mock_api.get.add_callback(d1_test.d1_test_case.MOCK_BASE_URL)
92+
# d1_test.mock_api.get.add_callback(d1_test.d1_test_case.MOCK_BASE_URL)
8993
self.client_v1 = d1_client.mnclient_1_1.MemberNodeClient_1_1(
9094
d1_test.d1_test_case.MOCK_BASE_URL
9195
)
9296
self.client_v2 = d1_client.mnclient_2_0.MemberNodeClient_2_0(
9397
d1_test.d1_test_case.MOCK_BASE_URL
9498
)
95-
self.test_client = d1_gmn.tests.gmn_test_client.GMNTestClient(
96-
d1_test.d1_test_case.MOCK_BASE_URL
97-
)
99+
# self.test_client = d1_gmn.tests.gmn_test_client.GMNTestClient(
100+
# d1_test.d1_test_case.MOCK_BASE_URL
101+
# )
98102
self.v1 = d1_common.types.dataoneTypes_v1_1
99103
self.v2 = d1_common.types.dataoneTypes_v2_0
100-
# Remove limit on max diff to show. This can cause debug output to
101-
# explode...
104+
# # Remove limit on max diff to show. This can cause debug output to
105+
# # explode...
102106
self.maxDiff = None
103107

104108
@property

gmn/src/d1_gmn/tests/test_archive_revision.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,31 @@ class TestArchiveRevision(d1_gmn.tests.gmn_test_case.GMNTestCase):
3232
@responses.activate
3333
def test_1000(self, cn_mn_client_v1_v2):
3434
"""archive(): Archived flag correctly set and represented"""
35-
with d1_gmn.tests.gmn_mock.disable_auth():
3635

37-
def assert_archived(client, pid):
38-
unarchived_sysmeta_pyxb = client.getSystemMetadata(pid)
39-
assert not unarchived_sysmeta_pyxb.archived
40-
pid_archived = client.archive(pid)
41-
assert pid == pid_archived.value()
42-
archived_sysmeta_pyxb = client.getSystemMetadata(pid)
43-
assert archived_sysmeta_pyxb.archived
44-
self.assert_eq_sysmeta_sid(
45-
unarchived_sysmeta_pyxb,
46-
archived_sysmeta_pyxb,
47-
)
36+
def assert_archived(client, pid):
37+
unarchived_sysmeta_pyxb = client.getSystemMetadata(pid)
38+
assert not unarchived_sysmeta_pyxb.archived
39+
pid_archived = client.archive(pid)
40+
assert pid == pid_archived.value()
41+
archived_sysmeta_pyxb = client.getSystemMetadata(pid)
42+
assert archived_sysmeta_pyxb.archived
43+
self.assert_eq_sysmeta_sid(
44+
unarchived_sysmeta_pyxb,
45+
archived_sysmeta_pyxb,
46+
)
47+
48+
# archive() is supported on both CNs and MNs. Since this test creates a
49+
# revision chain, and create() is only supported on MNs, we use the MN
50+
# client to create the objects when testing both CN and MN archive().
4851

49-
# archive() is supported on both CNs and MNs. Since this test creates a
50-
# revision chain, and create() is only supported on MNs, we use the MN
51-
# client to create the objects when testing both CN and MN archive().
52-
# with d1_gmn.tests.gmn_mock.disable_auth():
52+
# mock_get_system_metadata.add_callback(d1_test.d1_test_case.MOCK_BASE_URL)
53+
54+
with d1_gmn.tests.gmn_mock.disable_auth():
5355

5456
base_sid, pid_chain_list = self.create_revision_chain(
5557
self.client_v2, chain_len=5, sid=True, disable_auth=False
5658
)
59+
5760
self.assert_valid_chain(self.client_v2, pid_chain_list, base_sid)
5861

5962
# Archive head

gmn/src/d1_gmn/tests/test_create_and_get_standalone.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def test_1050(self, mn_client_v1_v2):
106106
"""create() / get(): Object with no explicit permissions can be retrieved
107107
by a trusted subject
108108
"""
109-
110109
pid, sid, sciobj_str, sysmeta_pyxb = self.create_obj(mn_client_v1_v2)
111110
self.get_obj(
112111
mn_client_v1_v2,

gmn/src/d1_gmn/tests/test_slice.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import datetime
2828
import random
2929

30+
# import logging
31+
# import pytest
3032
import responses
3133

3234
import d1_gmn.app.models
@@ -36,15 +38,20 @@
3638

3739
import d1_test.sample
3840

39-
# import logging
40-
4141

4242
@d1_test.d1_test_case.reproducible_random_decorator('TestSlice')
43-
# @freezegun.freeze_time('1978-05-27')
43+
# @pytest.mark.skip('SLOOOOOW')
4444
class TestSlice(d1_gmn.tests.gmn_test_case.GMNTestCase):
45-
def norm_entry_id(self, log):
46-
for log_entry_pyxb in log.logEntry:
47-
log_entry_pyxb.entryId = '1'
45+
# def setup_class(self):
46+
# with d1_gmn.tests.gmn_mock.disable_auth():
47+
# self._total_int = mn_client_v1_v2.getLogRecords(
48+
# start=0, count=0, fromDate=fromDate
49+
# ).total
50+
# assert self._total_int >= 2000, 'Need >= 2000 logEntry records for testing'
51+
# single_slice_log = mn_client_v1_v2.getLogRecords(
52+
# start=0, count=self._total_int, fromDate=fromDate
53+
# )
54+
# assert len(single_slice_log.logEntry) == self._total_int
4855

4956
def _test(self, mn_client_v1_v2, fromDate=None, vary_size=False):
5057
count_int = 789

gmn/src/d1_gmn/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2.3.5'
1+
__version__ = '2.3.6'

0 commit comments

Comments
 (0)