Skip to content

Commit 4ba2445

Browse files
committed
Merge remote-tracking branch 'origin/master' into fewer-preps
2 parents 3fb2c99 + 503486c commit 4ba2445

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4134
-664
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,9 @@ secrets.tar
100100

101101
# macOS attributes
102102
*.DS_Store
103+
104+
# pyre
105+
.pyre/
106+
107+
# pytest
108+
.pytest_cache/

.travis.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@ matrix:
77
env:
88
matrix:
99
- TEST_FILENAME=''
10-
- TEST_FILENAME=test_add_target.py::TestActiveFlag
11-
- TEST_FILENAME=test_add_target.py::TestApplicationMetadata
12-
- TEST_FILENAME=test_add_target.py::TestContentTypes
13-
- TEST_FILENAME=test_add_target.py::TestImage
14-
- TEST_FILENAME=test_add_target.py::TestMissingData
15-
- TEST_FILENAME=test_add_target.py::TestTargetName
16-
- TEST_FILENAME=test_add_target.py::TestUnexpectedData
17-
- TEST_FILENAME=test_add_target.py::TestWidth
10+
- TEST_FILENAME=test_add_target.py
1811
- TEST_FILENAME=test_authorization_header.py
1912
- TEST_FILENAME=test_database_summary.py
2013
- TEST_FILENAME=test_date_header.py::TestFormat
@@ -48,7 +41,6 @@ before_install:
4841
- travis_retry pip install --upgrade pip setuptools
4942
install:
5043
- travis_retry pip install --upgrade --editable .[dev]
51-
- travis_retry npm install -g markdownlint-cli
5244
cache: pip
5345
before_script:
5446
- python ci/set_secrets_file.py

CHANGELOG.rst

Whitespace-only changes.

CONTRIBUTING.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,15 @@ However, it must be set to ``multipart/form-data; boundary=<BOUNDARY>`` where ``
171171
The documentation page `How To Perform an Image Recognition Query <https://library.vuforia.com/articles/Solution/How-To-Perform-an-Image-Recognition-Query>`__ states that ``Content-Type`` with be the only response header.
172172
This is not the case.
173173

174+
The documentation page `How To Perform an Image Recognition Query <https://library.vuforia.com/articles/Solution/How-To-Perform-an-Image-Recognition-Query>`__ states that 10 is the maximum allowed value of ``max_num_results``.
175+
However, the maximum allowed value is 50.
176+
177+
A response to an invalid query may have an ``application/json`` content type but include text (not JSON) data.
178+
179+
After deleting a target, for up to approximately 30 seconds, matching it with a query returns a 500 response.
180+
181+
A target with the name ``\uffff`` gets stuck in processing.
182+
174183
Performing a release
175184
--------------------
176185

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recursive-include src/mock_vws/resources *

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ lint:
77
flake8 .
88
isort --recursive --check-only
99
mypy src/ tests/ ci/
10+
pip-extra-reqs src/
11+
pip-missing-reqs src/
1012
pydocstyle
1113
pylint *.py src tests ci
1214
pyroma .

README.rst

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,23 @@ To change the state, use the ``state`` parameter when calling the mock.
112112
113113
The states available in ``States`` are:
114114

115-
- ``WORKING``.
116-
This is the default state of the mock.
117-
- ``PROJECT_INACTIVE``.
118-
This happens when the license key has been deleted.
115+
- ``WORKING``.
116+
This is the default state of the mock.
117+
- ``PROJECT_INACTIVE``.
118+
This happens when the license key has been deleted.
119119

120120
The mock is tested against the real Vuforia Web Services.
121121
This ensures that the implemented features of the mock behave, at least to some extent, like the real Vuforia Web Services.
122122
However, the mocks of these error states are based on observations as they cannot be reliably reproduced.
123123

124+
Custom base URLs
125+
~~~~~~~~~~~~~~~~
126+
127+
``MockVWS`` mocks the Vuforia Web Services (VWS) API and the Vuforia Web Query API.
128+
These APIs have base URLs ``https://vws.vuforia.com`` and ``https://cloudreco.vuforia.com`` respectively.
129+
130+
``MockVWS`` takes the optional parameters ``base_vws_url`` and ``base_vwq_url`` to modify the base URLs of the mocked endpoints.
131+
124132
Processing time
125133
~~~~~~~~~~~~~~~
126134

@@ -162,6 +170,36 @@ Therefore, an image given a ‘success’ status by the mock may not be given a
162170
When updating an image for a target on the real Vuforia Web Services, the rating may stay the same.
163171
The mock changes the rating for a target to a different random number when the image is changed.
164172

173+
Matching targets in the processing state
174+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
175+
176+
Matching a target which is in the processing state sometimes returns a successful response with no results.
177+
Sometimes a 500 (INTERNAL SERVER ERROR) response is given.
178+
The mock always gives a 500 response.
179+
180+
Matching deleted targets
181+
~~~~~~~~~~~~~~~~~~~~~~~~
182+
183+
Matching a target which has been deleted returns a 500 (INTERNAL SERVER ERROR) response within the first few seconds.
184+
This timeframe is not consistent on the real Vuforia Web Services.
185+
On the mock, this timeframe is three seconds by default.
186+
``MockVWS`` takes a parameter ``query_recognizes_deletion_seconds`` to change this.
187+
188+
Accepted date formats for the Query API
189+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190+
191+
The Query API documentation is not clear on which date formats are expected exactly in the ``Date`` header.
192+
The mock is strict.
193+
That is, it accepts only a few date formats, and rejects all others.
194+
If you find a date format which is accepted by the real Query API but rejected by the mock, please create a GitHub issue.
195+
196+
Targets stuck in processing
197+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
198+
199+
On the real Vuforia Web Services, targets sometimes get stuck in the processing state.
200+
For example, targets with the name ``\uffff`` get stuck in the processing state.
201+
On the mock, no targets get stuck in the processing state.
202+
165203
.. |Build Status| image:: https://travis-ci.org/adamtheturtle/vws-python.svg?branch=master
166204
:target: https://travis-ci.org/adamtheturtle/vws-python
167205
.. |codecov| image:: https://codecov.io/gh/adamtheturtle/vws-python/branch/master/graph/badge.svg

ci/set_secrets_file.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def move_secrets_file() -> None:
1515
travis_builder_number = travis_job_number.split('.')[-1]
1616
secrets_dir = Path('ci_secrets')
1717
secrets_path = secrets_dir / f'vuforia_secrets_{travis_builder_number}.env'
18-
print(f'Using: {secrets_path}')
1918
shutil.copy(secrets_path, './vuforia_secrets.env')
2019

2120

dev-requirements.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
attrs==18.1.0 # Modern attrs is required for pytest
12
autoflake==1.2
23
check-manifest==0.37
34
codecov==2.0.15 # Upload coverage data
@@ -6,16 +7,17 @@ flake8==3.5.0 # Lint
67
flake8-commas==2.0.0 # Require silicon valley commas
78
flake8-quotes==1.0.0 # Require single quotes
89
freezegun==0.3.10 # Freeze time in tests
9-
hypothesis==3.56.8 # Generate test cases
10+
hypothesis==3.57.0 # Generate test cases
1011
isort==4.3.4 # Lint imports
11-
mypy==0.600 # Type checking
12+
mypy==0.610 # Type checking
13+
pip_check_reqs==2.0.3
1214
pydocstyle==2.1.1 # Lint docstrings
1315
pyenchant==2.0.0 # Bindings for a spellchecking sytem
14-
pylint==1.8.4 # Lint
15-
pyroma==2.3 # Packaging best practices checker
16+
pylint==1.9.2 # Lint
17+
pyroma==2.3.1 # Packaging best practices checker
1618
pytest-cov==2.5.1 # Measure code coverage
1719
pytest-envfiles==0.1.0 # Use files for environment variables for tests
18-
pytest==3.5.1 # Test runners
20+
pytest==3.6.1 # Test runners
1921
timeout-decorator==0.4.0 # Decorate functions to time out.
20-
vulture==0.26
22+
vulture==0.27
2123
yapf==0.21.0 # Automatic formatting for Python

pylintrc

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ disable=
7373
no-self-use,
7474
line-too-long,
7575
too-few-public-methods,
76+
too-many-lines,
7677
too-many-locals,
7778
too-many-arguments,
79+
too-many-instance-attributes,
80+
too-many-return-statements,
7881
locally-disabled,
7982
# Let flake8 handle unused imports
8083
unused-import,
@@ -148,10 +151,10 @@ const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
148151
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
149152

150153
# Regular expression matching correct method names
151-
method-rgx=[a-z_][a-z0-9_]{2,30}$
154+
method-rgx=[a-z_][a-z0-9_]{2,40}$
152155

153156
# Naming hint for method names
154-
method-name-hint=[a-z_][a-z0-9_]{2,30}$
157+
method-name-hint=[a-z_][a-z0-9_]{2,40}$
155158

156159
# Regular expression matching correct inline iteration names
157160
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
@@ -160,16 +163,16 @@ inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
160163
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
161164

162165
# Regular expression matching correct function names
163-
function-rgx=[a-z_][a-z0-9_]{2,30}$
166+
function-rgx=[a-z_][a-z0-9_]{2,50}$
164167

165168
# Naming hint for function names
166-
function-name-hint=[a-z_][a-z0-9_]{2,30}$
169+
function-name-hint=[a-z_][a-z0-9_]{2,50}$
167170

168171
# Regular expression matching correct variable names
169-
variable-rgx=[a-z_][a-z0-9_]{2,30}$
172+
variable-rgx=[a-z_][a-z0-9_]{2,50}$
170173

171174
# Naming hint for variable names
172-
variable-name-hint=[a-z_][a-z0-9_]{2,30}$
175+
variable-name-hint=[a-z_][a-z0-9_]{2,50}$
173176

174177
# Regular expression matching correct module names
175178
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
@@ -178,22 +181,22 @@ module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
178181
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
179182

180183
# Regular expression matching correct class attribute names
181-
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
184+
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,50}|(__.*__))$
182185

183186
# Naming hint for class attribute names
184-
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
187+
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,50}|(__.*__))$
185188

186189
# Regular expression matching correct argument names
187-
argument-rgx=[a-z_][a-z0-9_]{2,30}$
190+
argument-rgx=[a-z_][a-z0-9_]{2,50}$
188191

189192
# Naming hint for argument names
190-
argument-name-hint=[a-z_][a-z0-9_]{2,30}$
193+
argument-name-hint=[a-z_][a-z0-9_]{2,50}$
191194

192195
# Regular expression matching correct attribute names
193-
attr-rgx=[a-z_][a-z0-9_]{2,30}$
196+
attr-rgx=[a-z_][a-z0-9_]{2,50}$
194197

195198
# Naming hint for attribute names
196-
attr-name-hint=[a-z_][a-z0-9_]{2,30}$
199+
attr-name-hint=[a-z_][a-z0-9_]{2,50}$
197200

198201
# Regular expression matching correct class names
199202
class-rgx=[A-Z_][a-zA-Z0-9]+$

0 commit comments

Comments
 (0)