diff --git a/.gitignore b/.gitignore index 76e20d6..743acbb 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ dist/ *migrations/ MANIFEST patches.py -/examples/users/db.sqlite3 \ No newline at end of file +db.sqlite3 diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 09f379a..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -# Change Log - -## [Unreleased](https://github.com/stphivos/django-mock-queries/tree/HEAD) - -**Merged pull requests:** - -- django-rest-framework serializer assert function [\#5](https://github.com/stphivos/django-mock-queries/pull/5) ([stphivos](https://github.com/stphivos)) -- Test remaining crud functions and exception scenarios [\#4](https://github.com/stphivos/django-mock-queries/pull/4) ([stphivos](https://github.com/stphivos)) -- Test query aggregate, create and get functionality [\#3](https://github.com/stphivos/django-mock-queries/pull/3) ([stphivos](https://github.com/stphivos)) -- Fix and test query filtering by q objects [\#2](https://github.com/stphivos/django-mock-queries/pull/2) ([stphivos](https://github.com/stphivos)) -- Fix/remove pytest ini [\#1](https://github.com/stphivos/django-mock-queries/pull/1) ([stphivos](https://github.com/stphivos)) - - - -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..800a489 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include setup.cfg README.md requirements/requirements.txt +recursive-include django_mock_queries *.py diff --git a/django_mock_queries/query.py b/django_mock_queries/query.py index 72f31a9..c6f1156 100644 --- a/django_mock_queries/query.py +++ b/django_mock_queries/query.py @@ -320,6 +320,9 @@ def _meta(self): keys_list.remove('save') return MockOptions(*keys_list) + def __repr__(self): + return self.get('mock_name', None) or super(MockModel, self).__repr__() + def create_model(*fields): if len(fields) == 0: diff --git a/requirements/requirements-testing.in b/requirements/requirements-testing.in index 8ebedea..88ea780 100644 --- a/requirements/requirements-testing.in +++ b/requirements/requirements-testing.in @@ -1,4 +1,4 @@ --r requirements.txt +# -r requirements.txt pip-tools==1.7.0 pytest==3.0.3 diff --git a/requirements/requirements-testing.txt b/requirements/requirements-testing.txt index 7ecae25..8893cff 100644 --- a/requirements/requirements-testing.txt +++ b/requirements/requirements-testing.txt @@ -7,16 +7,11 @@ click==6.6 # via pip-tools configparser==3.5.0 # via flake8 coverage==3.7.1 -# Django==1.8.12 # via model-mommy, manually excluded for tox djangorestframework==3.3.2 enum34==1.1.6 # via flake8 first==2.0.1 # via pip-tools flake8==3.0.4 # via pytest-flake8 -funcsigs==1.0.2 mccabe==0.5.2 # via flake8 -mock==1.3.0 -model-mommy==1.2.6 -pbr==1.10.0 pip-tools==1.7.0 pluggy==0.3.1 # via tox py==1.4.31 # via pytest, tox @@ -26,6 +21,6 @@ pytest-cov==2.4.0 pytest-django==3.1.2 pytest-flake8==0.7 pytest==3.0.3 -six==1.10.0 +six==1.10.0 # via pip-tools tox==2.1.1 virtualenv==13.1.2 diff --git a/requirements/requirements.in b/requirements/requirements.in index de1e6df..dba1a60 100644 --- a/requirements/requirements.in +++ b/requirements/requirements.in @@ -1,3 +1,3 @@ mock==1.3.0 model_mommy==1.2.6 -Django==1.8.12 +Django>=1.8.17,<1.10.99 diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 26841da..0070af8 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -4,9 +4,9 @@ # # pip-compile --output-file requirements/requirements.txt requirements/requirements.in # -Django==1.8.12 # via model_mommy +Django>=1.8.17,<1.10.99 # manually edited and should remain a range of supported versions funcsigs==1.0.2 # via mock mock==1.3.0 model_mommy==1.2.6 -pbr==1.10.0 # via mock +pbr==2.0.0 # via mock six==1.10.0 # via mock, model_mommy diff --git a/setup.py b/setup.py index 028d077..d1f6d99 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,18 @@ from distutils.core import setup +from pip.req import parse_requirements + +install_req = parse_requirements('requirements/requirements.txt', session='skip') +req = [str(ir.req) for ir in install_req] setup( name='django_mock_queries', packages=['django_mock_queries'], - version='0.0.15', + version='0.0.16.5', description='A django library for mocking queryset functions in memory for testing', author='Phivos Stylianides', author_email='stphivos@gmail.com', url='https://github.com/stphivos/django-mock-queries', keywords=['django', 'mocking', 'unit-testing', 'tdd'], classifiers=[], + install_requires=req ) diff --git a/tests/test_query.py b/tests/test_query.py index be0c6db..1fb1921 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -741,3 +741,7 @@ def test_length2(self): def test_create_model_raises_value_error_with_zero_arguments(self): with self.assertRaises(ValueError): create_model() + + def test_query_model_repr_returns_mock_name(self): + model = MockModel(mock_name='model_name') + assert repr(model) == model.mock_name