miki725 / alchemy-mock

SQLAlchemy mock helpers.
Other
82 stars 15 forks source link

Added Delete, Get Functionality; Fixed abc import #39

Open rajivsarvepalli opened 3 years ago

rajivsarvepalli commented 3 years ago

I was using this library for some simple SqlAlchemy testing and found the lack of a basic delete somewhat preventative in mocking up queries and session commands. So I decided to add the delete functionality.

This solution is probably not the cleanest, but it does seem to work to a degree. Essentially, .delete()simply deletes whatever is returned by .all(). It seemed to be working in the manner I intended it to be for at least my case.

It should add basic support for deleting within the constraints of this library (it will not unify across queries).

Fixes #32

I also removed importing ABC directly from collections but kept it backwards compatible (or at least I hope so).

Fixes #35

coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 3b8afc0d112d9126f2d44203daecc951a3a520a6 on rajivsarvepalli:master into f8af8881b214e154131efe68bd2fd4083c84e066 on miki725:master.

rajivsarvepalli commented 3 years ago

Added support for get functionality with dictionaries and integers (the only scalar option allowed currently).

Fixed #38 Fixed #33

rajivsarvepalli commented 3 years ago

Build fails were a result of failing to install coveralls on pypy due to "Could not build wheels for cryptography which use PEP 517 and cannot be installed directly".

The branch works fine otherwise and has 100% test coverage on python 2.7, python 3.6, and python 3.7.

I changed the Travis file only to fix cryptography for PyPy by downgrading the version to less than 3. The build previously worked fine other than a pip install error for cryptography. With the cryptography downgrade, it passes all tests on travis.