Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AmendsenProject
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shaik Janipasha
AmendsenProject
Commits
bfc6f810
Unverified
Commit
bfc6f810
authored
Aug 17, 2020
by
Dorian Johnson
Committed by
GitHub
Aug 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: fix broken tests in Python 3.7, test in CI (#334)
parent
86f658d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
7 deletions
+20
-7
.travis.yml
.travis.yml
+2
-1
test_hive_table_last_updated_extractor.py
.../unit/extractor/test_hive_table_last_updated_extractor.py
+15
-5
test_mode_paginated_rest_api_query.py
..._api/mode_analytics/test_mode_paginated_rest_api_query.py
+3
-1
No files found.
.travis.yml
View file @
bfc6f810
language
:
python
python
:
python
:
-
'
3.6'
-
'
3.7'
install
:
-
pip install -r requirements.txt
-
pip install .[all]
...
...
tests/unit/extractor/test_hive_table_last_updated_extractor.py
View file @
bfc6f810
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import
itertools
import
logging
import
unittest
from
datetime
import
datetime
...
...
@@ -17,6 +18,15 @@ from databuilder.filesystem.filesystem import FileSystem
from
databuilder.filesystem.metadata
import
FileMetadata
def
null_iterator
(
items
):
"""
Returns an infinite iterator that returns the items from items,
then infinite Nones. Required because Extractor.extract is expected
to return None when it is exhausted, not terminate.
"""
return
itertools
.
chain
(
iter
(
items
),
itertools
.
repeat
(
None
))
class
TestHiveTableLastUpdatedExtractor
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -52,14 +62,14 @@ class TestHiveTableLastUpdatedExtractor(unittest.TestCase):
return_value
=
pt_alchemy_extractor_instance
),
\
patch
.
object
(
HiveTableLastUpdatedExtractor
,
'_get_non_partitioned_table_sql_alchemy_extractor'
,
return_value
=
non_pt_alchemy_extractor_instance
):
pt_alchemy_extractor_instance
.
extract
=
MagicMock
(
side_effect
=
[
pt_alchemy_extractor_instance
.
extract
=
MagicMock
(
side_effect
=
null_iterator
(
[
{
'schema'
:
'foo_schema'
,
'table_name'
:
'table_1'
,
'last_updated_time'
:
1
},
{
'schema'
:
'foo_schema'
,
'table_name'
:
'table_2'
,
'last_updated_time'
:
2
}
])
])
)
non_pt_alchemy_extractor_instance
.
extract
=
MagicMock
(
return_value
=
None
)
...
...
@@ -102,11 +112,11 @@ class TestHiveTableLastUpdatedExtractor(unittest.TestCase):
'_get_filesystem'
,
return_value
=
fs
):
pt_alchemy_extractor_instance
.
extract
=
MagicMock
(
return_value
=
None
)
non_pt_alchemy_extractor_instance
.
extract
=
MagicMock
(
side_effect
=
[
non_pt_alchemy_extractor_instance
.
extract
=
MagicMock
(
side_effect
=
null_iterator
(
[
{
'schema'
:
'foo_schema'
,
'table_name'
:
'table_1'
,
'location'
:
'/foo/bar'
}
])
'location'
:
'/foo/bar'
}
,
])
)
extractor
=
HiveTableLastUpdatedExtractor
()
extractor
.
init
(
ConfigFactory
.
from_dict
({}))
...
...
tests/unit/rest_api/mode_analytics/test_mode_paginated_rest_api_query.py
View file @
bfc6f810
...
...
@@ -30,11 +30,13 @@ class TestModePaginatedRestApiQuery(unittest.TestCase):
{
'foo'
:
[{
'name'
:
'v3'
}]},
{
'foo'
:
[{
'name'
:
'v4'
},
{
'name'
:
'v5'
}]},
{
'foo'
:
[{
'name'
:
'v4'
},
{
'name'
:
'v5'
}]},
{},
{}
]
query
=
ModePaginatedRestApiQuery
(
query_to_join
=
seed_query
,
url
=
'foobar'
,
params
=
{},
json_path
=
json_path
,
field_names
=
field_names
,
pagination_json_path
=
'foo[*]'
,
skip_no_result
=
True
,
pagination_json_path
=
'foo[*]'
,
max_record_size
=
2
)
expected_list
=
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment