Skip to content

Commit

Permalink
#35: Pinned faker, psycopg2 and pyyaml for older Python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hkage committed Nov 30, 2021
1 parent 5c6a59f commit 4ce61c5
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Development

* [#35](https://github.com/rheinwerk-verlag/postgresql-anonymizer/issues/35): Pinned parmap version for Python 2.7
* [#35](https://github.com/rheinwerk-verlag/postgresql-anonymizer/issues/35): Pinned requirements for older Python versions
* [#32](https://github.com/rheinwerk-verlag/postgresql-anonymizer/pull/32): Fixed pg_dump arguments ([korsar182](https://github.com/korsar182))
* Simplified provider registration (no metaclass usage anymore)

Expand Down
114 changes: 113 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,19 @@ repository = "https://github.com/rheinwerk-verlag/postgresql-anonymizer"
python = "~2.7 || ^3.5"
Faker = [
{ version = "^3.0.0", python = "~2.7"},
{ version = "^4.9.0", python = "^3.5"}
{ version = "^4.9.0", python = "~3.5"},
{ version = "^9.9.0", python = "^3.6"}
]
psycopg2-binary = [
{ version = "~2.8.4", python = "~2.7"},
{ version = "~2.8.4", python = "~3.5"},
{ version = "^2.9.2", python = "^3.6"}
]
pyyaml = [
{ version = "^5.2", python = "~2.7" },
{ version = "^5.2", python = "~3.5" },
{ version = "^6.0", python = "^3.6" }
]
psycopg2-binary = "^2.8.4"
pyyaml = "^5.2"
parmap = [
{ version = "1.5.2", python = "~2.7"},
{ version = "1.5.2", python = "~3.5"},
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ def run(self):

install_requires = [
'faker',
'faker>=3.0,<4.0; python_version=="2.7"',
'faker>=4.0,<5.0; python_version=="3.5"',
'parmap; python_version>="3.6"',
'parmap<1.5.3; python_version<"3.6"',
'parmap==1.5.2; python_version<"3.6"',
'pgcopy',
'psycopg2',
'psycopg2>=2.8.4,<2.9; python_version<"3.6"',
'pyyaml',
'pyyaml>=5.2,<6.0; python_version<"3.6"',
'tqdm'
]

Expand Down
10 changes: 5 additions & 5 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def test(self, inspect, util, quote_ident, tmp_table, cols, data):
expected = [call('COPY "public"."src_tbl" ("id", "location") FROM STDIN WITH BINARY', ANY)]
assert mock_cursor.copy_expert.call_args_list == expected

@ patch('pganonymizer.utils.CopyManager')
@ patch('psycopg2.extensions.quote_ident', side_effect=quote_ident)
@patch('pganonymizer.utils.CopyManager')
@patch('psycopg2.extensions.quote_ident', side_effect=quote_ident)
def test_anonymize_tables(self, quote_ident, copy_manager):
mock_cursor = Mock()
mock_cursor.fetchone.return_value = [2]
Expand Down Expand Up @@ -162,9 +162,9 @@ def test_anonymize_tables(self, quote_ident, copy_manager):


class TestBuildAndThenImport:
@ patch('psycopg2.extensions.quote_ident', side_effect=quote_ident)
@ patch('pganonymizer.utils.CopyManager')
@ pytest.mark.parametrize('table, primary_key, columns, total_count, chunk_size', [
@patch('psycopg2.extensions.quote_ident', side_effect=quote_ident)
@patch('pganonymizer.utils.CopyManager')
@pytest.mark.parametrize('table, primary_key, columns, total_count, chunk_size', [
['src_tbl', 'id', [{'col1': {'provider': {'name': 'md5'}}},
{'COL2': {'provider': {'name': 'md5'}}}], 10, 3]
])
Expand Down

0 comments on commit 4ce61c5

Please sign in to comment.