├── .bumpversion.cfg ├── .gitignore ├── .travis.yml ├── AUTHORS.rst ├── CHANGES.rst ├── CONTRIBUTING.rst ├── COPYING ├── MANIFEST.in ├── README.rst ├── docs ├── Makefile ├── authors.rst ├── changelog.rst ├── conf.py └── index.rst ├── pylama.ini ├── pytest.ini ├── requirements-test.txt ├── setup.py └── src └── pytest_dbfixtures └── __init__.py /.bumpversion.cfg: -------------------------------------------------------------------------------- 1 | [bumpversion] 2 | commit = True 3 | tag = True 4 | message = Release {new_version} 5 | current_version = 1.0.0 6 | 7 | [bumpversion:file:src/pytest_dbfixtures/__init__.py] 8 | 9 | [bumpversion:file:README.rst] 10 | 11 | [bumpversion:file:CHANGES.rst] 12 | search = unreleased 13 | ------ 14 | replace = {new_version} 15 | ------ 16 | 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .cache/* 2 | *.py[cod] 3 | 4 | # C extensions 5 | *.so 6 | 7 | # Packages 8 | *.egg 9 | *.egg-info 10 | dist 11 | build 12 | eggs 13 | parts 14 | bin 15 | var 16 | sdist 17 | results 18 | develop-eggs 19 | .installed.cfg 20 | lib 21 | lib64 22 | 23 | # Installer logs 24 | pip-log.txt 25 | 26 | # Unit test / coverage reports 27 | htmlcov/* 28 | .coverage 29 | .tox 30 | nosetests.xml 31 | 32 | # Translations 33 | *.mo 34 | 35 | # Mr Developer 36 | .mr.developer.cfg 37 | .project 38 | .pydevproject 39 | 40 | # vim files 41 | *.swp 42 | 43 | # redis logs 44 | *.log 45 | 46 | # erl dump: 47 | *.dump 48 | 49 | # pycharm files 50 | atlassian-ide-plugin.xml 51 | .idea/ 52 | 53 | # docs 54 | docs/_build/ 55 | 56 | # osx 57 | .DS_Store 58 | ._.DS_Store 59 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: 2 | - python 3 | sudo: false 4 | python: 5 | - '2.7' 6 | - '3.3' 7 | - '3.4' 8 | - '3.5' 9 | - '3.6' 10 | env: 11 | install: 12 | - pip install -r requirements-test.txt wheel 13 | script: 14 | - pylama 15 | deploy: 16 | provider: pypi 17 | user: thearoom 18 | password: 19 | secure: W7fbSxVIuB6pHMLhzEwXG1GnxF+36hOC7RO2+Z1JoKFPFeRnz013GqZVgdvsjpu/Pb9t1dv+trjZqviIrauxKdGMqQxhtLl7A8G0j1sX59GG6DH/9iggAeJKWrcAt+czHXIPnpOopeNTqfTRs8cdaR7I+1wJzSS/tN6MUCanF6U= 20 | on: 21 | tags: true 22 | distributions: sdist bdist_wheel 23 | repo: ClearcodeHQ/pytest-dbfixtures 24 | -------------------------------------------------------------------------------- /AUTHORS.rst: -------------------------------------------------------------------------------- 1 | Authors 2 | ======= 3 | 4 | This file contains the list of people involved in the development of 5 | pytest-dbfixtures along it's history. 6 | 7 | * Paweł Wilczyński 8 | * Tomasz Święcicki 9 | * Tomasz Karbownicki 10 | * Grzegorz Śliwiński 11 | * Przemysław Spodymek 12 | * Jonas Brunsgaard 13 | * Donald Stufft 14 | * Hans Duedal 15 | * Domen Kožar 16 | * Dwayne Litzenberger 17 | * Karolina Blümke 18 | * Michał Masłowski 19 | * Georg Walther 20 | * Jakub Klinkovský 21 | 22 | Great thanks to `Clearcode `_ for allowing releasing 23 | pytest-dbfixtures as free software! 24 | -------------------------------------------------------------------------------- /CHANGES.rst: -------------------------------------------------------------------------------- 1 | CHANGES 2 | ======= 3 | 4 | 1.0.0 5 | ------ 6 | 7 | - [enhancements] removed all leftover code and limited documentation, directed to each indicidual packages. 8 | - [enhancements] split out Redis fixtures into separate package. See `pytest-redis `_ 9 | - [enhancements] split out RabbitMQ fixtures into separate package. See `pytest-rabbitmq `_ 10 | - [enhancements] split out MySQL fixtures into separate package. See `pytest-mysql `_ 11 | - [enhancements] split out DynamoDB fixtures into separate package. See `pytest-dynamodb `_ 12 | 13 | 0.17.0 14 | ------ 15 | 16 | - [enhancement] split out PostgreSQL fixtures into separate package. See `pytest-postgresql `_ 17 | - [enhancement] split out MongoDB fixtures into separate package. See `pytest-mongo `_ 18 | 19 | 0.16.0 20 | ------ 21 | 22 | - [enhancements] Postgresql client fixture closes other postgresql connection to the database before droping database - prevents the fixture/tests from hanging in some cases 23 | - [enhancements] mysql to use unique tmpdir option for mysql_* commands 24 | - [enhancements] use semicolon to terminate postgresql CREATE/DROP DATABASE statements 25 | - [bugfix] removed unneded dependency 26 | - [enhancement] split out elasticsearch fixtures into separate package. See `pytest-elasticsearch `_ 27 | - [feature] use tmpfile.gettempdir instead of hardcoded /tmp directory 28 | 29 | 0.15.0 30 | ------ 31 | 32 | - [fix] support for rabbitpy 0.27.x 33 | - [feature] Random port selection ports accept tuples and sets. replace string representation [backward incompatible] 34 | 35 | 36 | 0.14.3 37 | ------ 38 | 39 | - [feature] Add support for delayTransientStatuses flag (DynamoDB) 40 | 41 | 0.14.2 42 | ------ 43 | 44 | - [fix] Update DynamoDB in howtouse 45 | 46 | 0.14.1 47 | ------ 48 | 49 | - [fix] packaging/changelog fix 50 | 51 | 0.14.0 52 | ------ 53 | 54 | - [feature] add fixture for DynamoDB 55 | 56 | 0.13.1 57 | ------ 58 | 59 | - [bugfix] fix dbfixtures packaging 60 | 61 | 0.13.0 62 | ------ 63 | 64 | - [feature] make it easier to support future postgresql out of the box 65 | - [feature] support for postgresql 9.5 66 | - [docs] add contribute guidelines 67 | - [feature] add info about minimal version supported - closes #132 68 | - [enhancements] - moved source code into src folder 69 | - [feature] python3.5 compatibility 70 | - [docs] enhance docs - refs #126 71 | - [feature] PGsql connection error on FreeBSD jailed environments 72 | 73 | In FreeBSD jailed environments the loopback interface can not be used to 74 | connect to pgsql, because it points to the loopback interface of the host and 75 | not the jail. 76 | 77 | Thus, it seems to pgsql like the connection is comming from the ip address 78 | assigned to the jail. 79 | 80 | This ensures that pgsql can be connected to from any host, when 81 | run on a FreeBSD systems. This this package can be used in FreeBSD 82 | jailed environments 83 | 84 | - [feature] Use log destination param for pgsql 85 | 86 | This commit ensures that `stderr` is used for logging, by 87 | specifying the command line parameter. 88 | 89 | On FreeBSD this is very important otherwise syslog will be used and 90 | the db-fixtures will hang as it looks in the expected log file and 91 | loops forever waiting for a "database is ready" entry to appear... 92 | `log_destination=stderr` is default on most systems and can be set in 93 | `postgresql.conf` or given as an command line argument. 94 | 95 | `Read more `_ 96 | 97 | 0.12.0 98 | ------ 99 | 100 | - [bugfix] mongodb fixture no longer removes any of system.* collections 101 | - [bugfix] configured pytest-dbfixtures to work with pymlconf versions compatible with Python 3 102 | 103 | 0.11.0 104 | ------ 105 | 106 | - make pytest-dbfixtures compatible with mirakuru 0.5.0 107 | 108 | 109 | 0.10.0 110 | ------ 111 | 112 | - fix W503 pep8 errors, that appeared after new pylama got released 113 | - update to be able to use pytest-dbfixtures with pymongo 3 114 | - ability to properly use also beta versions of postgresql releases. (previously only stable versions were targeted) 115 | 116 | 117 | 0.9.0 118 | ----- 119 | 120 | - add ability to set custom location for logs (might be useful for analysing logs from tests) 121 | - added postgresql 9.4 to supported versions. 122 | 123 | 0.8.2 124 | ----- 125 | 126 | - Use port number in default RabbitMQ node name. 127 | 128 | This allows using just the port='?' argument to rabbitmq_proc to run multiple 129 | independent RabbitMQ instances for use with xdist to parallelize tests on a 130 | single machine. 131 | 132 | - Old versions of Redis notification 133 | 134 | displays a message about old version of redis 135 | 136 | 0.8.1 137 | ----- 138 | 139 | - Feature: random ports selection 140 | Adds a possibility of passing '?' in port= argument of process fixtures. 141 | - Removes 'port' from db fixtures 142 | - Fixes postgres missing host - previously using config.postgresql.unixsocketdir 143 | 144 | 145 | 0.7.0 146 | ----- 147 | 148 | - redisdb fixture allows to specify client connection class 149 | - redisdb fixture uses now StrictRedis by default (backward incompatible) 150 | 151 | 0.6.0 152 | ----- 153 | 154 | - replaced *MySQLdb* with it's fork *mysqlclient* - compatibility with python3 155 | - renamed mysqldb fixture to mysql to keep it consistent with other client fixtures. 156 | - replaced *pika* with python 3 compatible rabbitpy 157 | - removed deprecated mysqldb_session/mysql_session 158 | - bugfix of rabbitmq fixture: cast rabbitmq queues and exchanges to str due to pamq having problems 159 | - internal changes: removed GentleKillingExecutor as mirakuru already implements same functionality 160 | 161 | 0.5.2 162 | ----- 163 | 164 | * syntax fixes for python 3 165 | * moved postgresql starting code into it's own executor 166 | * xdist distributed hosts testing bugfix (but xdist parallelization on one host won't work) 167 | 168 | 0.5.1 169 | ----- 170 | 171 | * make rabbitmq logs persistent 172 | 173 | 0.5.0 174 | ----- 175 | 176 | * update mirakuru to min 0.2 177 | * os.killpg to terminate process 178 | * add tests coverage on coveralls 179 | 180 | 0.4.22 181 | ------ 182 | 183 | * remove creating old RABBITMQ env variables 184 | 185 | 0.4.21 186 | ------ 187 | 188 | * remove elasticsearch home folder at process teardown 189 | * set elasticsearch index.store.type to memory by default 190 | * localized elasticsearch instance by default 191 | * replaced summon_process with mirakuru 192 | 193 | 0.4.20 194 | ------ 195 | 196 | * RabbitMQ process fixture is session scoped 197 | * rabbitmq fixture factory accepts custom teardown 198 | 199 | 200 | 0.4.19 201 | ------ 202 | 203 | * StopRunningExecutor to simply return if process had been already killed. 204 | 205 | 0.4.18 206 | ------ 207 | 208 | * MongoDB fixtures can be now initialized by factories 209 | 210 | 211 | 0.4.17 212 | ------ 213 | 214 | * Bugfix: params in redis fixture 215 | 216 | 217 | 0.4.16 218 | ------- 219 | 220 | * Add params to mysql fixture 221 | 222 | 223 | 0.4.15 224 | ------- 225 | 226 | * Client fixtures now check if process (process fixture) is running before 227 | every test and starts process if it was terminated after previous test. 228 | 229 | 230 | 0.4.14 231 | ------- 232 | 233 | * Bugfix: Now we don't overwrite postgresql config in postgres_proc 234 | 235 | 236 | 0.4.13 237 | ------- 238 | 239 | * Bugfix of rabbitmq_proc fixture - now it works with scope=function 240 | 241 | 242 | 0.4.12 243 | ------- 244 | 245 | * Overrides SimpleExecutor's behavior with a try of more gentle terminating 246 | subprocess before killing it. 247 | * Deprecate scope for mysqldb fixture and change it to function by default. 248 | * RabbitMQ factories support (multiple rabbit fixtures). 249 | 250 | 251 | 0.4.10 252 | ------- 253 | 254 | * Postgresql multiple versions proper support 255 | * Default timeouts and waits for process executors 256 | 257 | 258 | 0.4.8 259 | ------- 260 | 261 | * introduced Elasticsearch fixture 262 | 263 | 264 | 0.4.6 265 | ------- 266 | 267 | * mysql fixture now uses factories 268 | 269 | 270 | 0.4.4 271 | ------- 272 | 273 | * postgresql fixtures and fixture factories 274 | * small code quality improvements 275 | * pylama code check 276 | 277 | 278 | 0.4.3 279 | ------- 280 | 281 | * splits rabbitmq fixture into process/client fixtures 282 | -------------------------------------------------------------------------------- /CONTRIBUTING.rst: -------------------------------------------------------------------------------- 1 | Contribute to pytest-dbfixtures 2 | =============================== 3 | 4 | Thank you for taking time to contribute to pytest-dbfixtures! 5 | 6 | The following is a set of guidelines for contributing to pytest-dbfixtures. These are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request. 7 | 8 | Bug Reports 9 | ----------- 10 | 11 | #. Use a clear and descriptive title for the issue - it'll be much easier to identify the problem. 12 | #. Describe the steps to reproduce the problems in as many details as possible. 13 | #. If possible, provide a code snippet to reproduce the issue. 14 | 15 | Feature requests/proposals 16 | -------------------------- 17 | 18 | #. Use a clear and descriptive title for the proposal 19 | #. Provide as detailed description as possible 20 | * Use case is great to have 21 | #. There'll be a bit of discussion for the feature. Don't worry, if it is to be accepted, we'd like to support it, so we need to understand it thoroughly. 22 | 23 | 24 | Pull requests 25 | ------------- 26 | 27 | #. Start with a bug report or feature request 28 | #. Use a clear and descriptive title 29 | #. Provide a description - which issue does it refers to, and what part of the issue is being solved 30 | #. Be ready for code review :) 31 | 32 | Commits 33 | ------- 34 | 35 | #. Make sure commits are atomic, and each atomic change is being followed by test. 36 | #. If the commit solves part of the issue reported, include *refs #[Issue number]* in a commit message. 37 | #. If the commit solves whole issue reported, please refer to `Closing issues via commit messages `_ for ways to close issues when commits will be merged. 38 | 39 | 40 | Coding style 41 | ------------ 42 | 43 | #. All python coding style are being enforced by `Pylama `_ and configured in pylama.ini file. 44 | #. Additional, not always mandatory checks are being performed by `QuantifiedCode `_ 45 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include *.rst 2 | recursive-include src/pytest_dbfixtures *.py 3 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | pytest-dbfixtures 2 | ================= 3 | 4 | 5 | .. image:: https://img.shields.io/pypi/v/pytest-dbfixtures.svg 6 | :target: https://pypi.python.org/pypi/pytest-dbfixtures/ 7 | :alt: Latest PyPI version 8 | 9 | .. image:: https://readthedocs.org/projects/pytest-dbfixtures/badge/?version=v1.0.0 10 | :target: http://pytest-dbfixtures.readthedocs.org/en/v1.0.0/ 11 | :alt: Documentation Status 12 | 13 | .. image:: https://img.shields.io/pypi/wheel/pytest-dbfixtures.svg 14 | :target: https://pypi.python.org/pypi/pytest-dbfixtures/ 15 | :alt: Wheel Status 16 | 17 | .. image:: https://img.shields.io/pypi/pyversions/pytest-dbfixtures.svg 18 | :target: https://pypi.python.org/pypi/pytest-dbfixtures/ 19 | :alt: Supported Python Versions 20 | 21 | .. image:: https://img.shields.io/pypi/l/pytest-dbfixtures.svg 22 | :target: https://pypi.python.org/pypi/pytest-dbfixtures/ 23 | :alt: License 24 | 25 | Overview 26 | -------- 27 | 28 | 29 | Pytest dbfixtures was a pytest plugin that makes it a lot easier 30 | to set up proper database or storage engine for testing. 31 | 32 | As of version 1.0.0 every process fixture got moved into it's own pytest plugin for easier maintenance, 33 | and pytest-dbfixture itself got converted into the meta-package. 34 | 35 | List of packages: 36 | 37 | * `pytest-elasticsearch `_ 38 | * `pytest-postgresql `_ 39 | * `pytest-dynamodb `_ 40 | * `pytest-rabbitmq `_ 41 | * `pytest-mysql `_ 42 | * `pytest-redis `_ 43 | * `pytest-mongo `_ 44 | 45 | Please see individual packages on how to use them, although their usage is pretty similar. 46 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 14 | # the i18n builder cannot share the environment and doctrees with the others 15 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 16 | 17 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext 18 | 19 | help: 20 | @echo "Please use \`make ' where is one of" 21 | @echo " html to make standalone HTML files" 22 | @echo " dirhtml to make HTML files named index.html in directories" 23 | @echo " singlehtml to make a single large HTML file" 24 | @echo " pickle to make pickle files" 25 | @echo " json to make JSON files" 26 | @echo " htmlhelp to make HTML files and a HTML help project" 27 | @echo " qthelp to make HTML files and a qthelp project" 28 | @echo " devhelp to make HTML files and a Devhelp project" 29 | @echo " epub to make an epub" 30 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 31 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 32 | @echo " text to make text files" 33 | @echo " man to make manual pages" 34 | @echo " texinfo to make Texinfo files" 35 | @echo " info to make Texinfo files and run them through makeinfo" 36 | @echo " gettext to make PO message catalogs" 37 | @echo " changes to make an overview of all changed/added/deprecated items" 38 | @echo " linkcheck to check all external links for integrity" 39 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 40 | 41 | clean: 42 | -rm -rf $(BUILDDIR)/* 43 | 44 | html: 45 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 46 | @echo 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 48 | 49 | dirhtml: 50 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 51 | @echo 52 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 53 | 54 | singlehtml: 55 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 56 | @echo 57 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 58 | 59 | pickle: 60 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 61 | @echo 62 | @echo "Build finished; now you can process the pickle files." 63 | 64 | json: 65 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 66 | @echo 67 | @echo "Build finished; now you can process the JSON files." 68 | 69 | htmlhelp: 70 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 71 | @echo 72 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 73 | ".hhp project file in $(BUILDDIR)/htmlhelp." 74 | 75 | qthelp: 76 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 77 | @echo 78 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 79 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 80 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pytestdbfixtures.qhcp" 81 | @echo "To view the help file:" 82 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pytestdbfixtures.qhc" 83 | 84 | devhelp: 85 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 86 | @echo 87 | @echo "Build finished." 88 | @echo "To view the help file:" 89 | @echo "# mkdir -p $$HOME/.local/share/devhelp/pytestdbfixtures" 90 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pytestdbfixtures" 91 | @echo "# devhelp" 92 | 93 | epub: 94 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 95 | @echo 96 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 97 | 98 | latex: 99 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 100 | @echo 101 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 102 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 103 | "(use \`make latexpdf' here to do that automatically)." 104 | 105 | latexpdf: 106 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 107 | @echo "Running LaTeX files through pdflatex..." 108 | $(MAKE) -C $(BUILDDIR)/latex all-pdf 109 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 110 | 111 | text: 112 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 113 | @echo 114 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 115 | 116 | man: 117 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 118 | @echo 119 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 120 | 121 | texinfo: 122 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 123 | @echo 124 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." 125 | @echo "Run \`make' in that directory to run these through makeinfo" \ 126 | "(use \`make info' here to do that automatically)." 127 | 128 | info: 129 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo 130 | @echo "Running Texinfo files through makeinfo..." 131 | make -C $(BUILDDIR)/texinfo info 132 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." 133 | 134 | gettext: 135 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale 136 | @echo 137 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." 138 | 139 | changes: 140 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 141 | @echo 142 | @echo "The overview file is in $(BUILDDIR)/changes." 143 | 144 | linkcheck: 145 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 146 | @echo 147 | @echo "Link check complete; look for any errors in the above output " \ 148 | "or in $(BUILDDIR)/linkcheck/output.txt." 149 | 150 | doctest: 151 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 152 | @echo "Testing of doctests in the sources finished, look at the " \ 153 | "results in $(BUILDDIR)/doctest/output.txt." 154 | -------------------------------------------------------------------------------- /docs/authors.rst: -------------------------------------------------------------------------------- 1 | .. _authors: 2 | 3 | .. include:: ../AUTHORS.rst 4 | -------------------------------------------------------------------------------- /docs/changelog.rst: -------------------------------------------------------------------------------- 1 | .. _changelog: 2 | 3 | .. include:: ../CHANGES.rst 4 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # pytest dbfixtures documentation build configuration file, created by 4 | # sphinx-quickstart on Sat Jan 25 23:48:05 2014. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys 15 | import os 16 | 17 | # If extensions (or modules to document with autodoc) are in another directory, 18 | # add these directories to sys.path here. If the directory is relative to the 19 | # documentation root, use os.path.abspath to make it absolute, like shown here. 20 | #sys.path.insert(0, os.path.abspath('.')) 21 | 22 | # -- General configuration ----------------------------------------------------- 23 | 24 | # If your documentation needs a minimal Sphinx version, state it here. 25 | #needs_sphinx = '1.0' 26 | 27 | # Add any Sphinx extension module names here, as strings. They can be extensions 28 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 29 | extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.coverage', 'sphinx.ext.viewcode'] 30 | 31 | # Add any paths that contain templates here, relative to this directory. 32 | templates_path = ['_templates'] 33 | 34 | # The suffix of source filenames. 35 | source_suffix = '.rst' 36 | 37 | # The encoding of source files. 38 | #source_encoding = 'utf-8-sig' 39 | 40 | # The master toctree document. 41 | master_doc = 'index' 42 | 43 | # General information about the project. 44 | project = u'pytest dbfixtures' 45 | copyright = u'2014, Clearcode - The A Room' 46 | 47 | from pytest_dbfixtures import __version__ 48 | 49 | # The version info for the project you're documenting, acts as replacement for 50 | # |version| and |release|, also used in various other places throughout the 51 | # built documents. 52 | # 53 | # The short X.Y version. 54 | version = __version__ 55 | # The full version, including alpha/beta/rc tags. 56 | release = __version__ 57 | 58 | # The language for content autogenerated by Sphinx. Refer to documentation 59 | # for a list of supported languages. 60 | #language = None 61 | 62 | # There are two options for replacing |today|: either, you set today to some 63 | # non-false value, then it is used: 64 | #today = '' 65 | # Else, today_fmt is used as the format for a strftime call. 66 | #today_fmt = '%B %d, %Y' 67 | 68 | # List of patterns, relative to source directory, that match files and 69 | # directories to ignore when looking for source files. 70 | exclude_patterns = ['_build'] 71 | 72 | # The reST default role (used for this markup: `text`) to use for all documents. 73 | #default_role = None 74 | 75 | # If true, '()' will be appended to :func: etc. cross-reference text. 76 | #add_function_parentheses = True 77 | 78 | # If true, the current module name will be prepended to all description 79 | # unit titles (such as .. function::). 80 | #add_module_names = True 81 | 82 | # If true, sectionauthor and moduleauthor directives will be shown in the 83 | # output. They are ignored by default. 84 | #show_authors = False 85 | 86 | # The name of the Pygments (syntax highlighting) style to use. 87 | pygments_style = 'sphinx' 88 | 89 | # A list of ignored prefixes for module index sorting. 90 | #modindex_common_prefix = [] 91 | 92 | 93 | # -- Options for HTML output --------------------------------------------------- 94 | 95 | # The theme to use for HTML and HTML Help pages. See the documentation for 96 | # a list of builtin themes. 97 | html_theme = 'nature' 98 | 99 | # Theme options are theme-specific and customize the look and feel of a theme 100 | # further. For a list of options available for each theme, see the 101 | # documentation. 102 | #html_theme_options = {} 103 | 104 | # Add any paths that contain custom themes here, relative to this directory. 105 | #html_theme_path = [] 106 | 107 | # The name for this set of Sphinx documents. If None, it defaults to 108 | # " v documentation". 109 | #html_title = None 110 | 111 | # A shorter title for the navigation bar. Default is the same as html_title. 112 | #html_short_title = None 113 | 114 | # The name of an image file (relative to this directory) to place at the top 115 | # of the sidebar. 116 | #html_logo = None 117 | 118 | # The name of an image file (within the static path) to use as favicon of the 119 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 120 | # pixels large. 121 | #html_favicon = None 122 | 123 | # Add any paths that contain custom static files (such as style sheets) here, 124 | # relative to this directory. They are copied after the builtin static files, 125 | # so a file named "default.css" will overwrite the builtin "default.css". 126 | html_static_path = ['_static'] 127 | 128 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 129 | # using the given strftime format. 130 | #html_last_updated_fmt = '%b %d, %Y' 131 | 132 | # If true, SmartyPants will be used to convert quotes and dashes to 133 | # typographically correct entities. 134 | #html_use_smartypants = True 135 | 136 | # Custom sidebar templates, maps document names to template names. 137 | #html_sidebars = {} 138 | 139 | # Additional templates that should be rendered to pages, maps page names to 140 | # template names. 141 | #html_additional_pages = {} 142 | 143 | # If false, no module index is generated. 144 | #html_domain_indices = True 145 | 146 | # If false, no index is generated. 147 | #html_use_index = True 148 | 149 | # If true, the index is split into individual pages for each letter. 150 | #html_split_index = False 151 | 152 | # If true, links to the reST sources are added to the pages. 153 | #html_show_sourcelink = True 154 | 155 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 156 | #html_show_sphinx = True 157 | 158 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 159 | #html_show_copyright = True 160 | 161 | # If true, an OpenSearch description file will be output, and all pages will 162 | # contain a tag referring to it. The value of this option must be the 163 | # base URL from which the finished HTML is served. 164 | #html_use_opensearch = '' 165 | 166 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 167 | #html_file_suffix = None 168 | 169 | # Output file base name for HTML help builder. 170 | htmlhelp_basename = 'pytestdbfixturesdoc' 171 | 172 | 173 | # -- Options for LaTeX output -------------------------------------------------- 174 | 175 | latex_elements = { 176 | # The paper size ('letterpaper' or 'a4paper'). 177 | #'papersize': 'letterpaper', 178 | 179 | # The font size ('10pt', '11pt' or '12pt'). 180 | #'pointsize': '10pt', 181 | 182 | # Additional stuff for the LaTeX preamble. 183 | #'preamble': '', 184 | } 185 | 186 | # Grouping the document tree into LaTeX files. List of tuples 187 | # (source start file, target name, title, author, documentclass [howto/manual]). 188 | latex_documents = [ 189 | ('index', 'pytestdbfixtures.tex', u'pytest dbfixtures Documentation', 190 | u'Clearcode - The A Room', 'manual'), 191 | ] 192 | 193 | # The name of an image file (relative to this directory) to place at the top of 194 | # the title page. 195 | #latex_logo = None 196 | 197 | # For "manual" documents, if this is true, then toplevel headings are parts, 198 | # not chapters. 199 | #latex_use_parts = False 200 | 201 | # If true, show page references after internal links. 202 | #latex_show_pagerefs = False 203 | 204 | # If true, show URL addresses after external links. 205 | #latex_show_urls = False 206 | 207 | # Documents to append as an appendix to all manuals. 208 | #latex_appendices = [] 209 | 210 | # If false, no module index is generated. 211 | #latex_domain_indices = True 212 | 213 | 214 | # -- Options for manual page output -------------------------------------------- 215 | 216 | # One entry per manual page. List of tuples 217 | # (source start file, name, description, authors, manual section). 218 | man_pages = [ 219 | ('index', 'pytestdbfixtures', u'pytest dbfixtures Documentation', 220 | [u'Clearcode - The A Room'], 1) 221 | ] 222 | 223 | # If true, show URL addresses after external links. 224 | #man_show_urls = False 225 | 226 | 227 | # -- Options for Texinfo output ------------------------------------------------ 228 | 229 | # Grouping the document tree into Texinfo files. List of tuples 230 | # (source start file, target name, title, author, 231 | # dir menu entry, description, category) 232 | texinfo_documents = [ 233 | ('index', 'pytestdbfixtures', u'pytest dbfixtures Documentation', 234 | u'Clearcode - The A Room', 'pytestdbfixtures', 'One line description of project.', 235 | 'Miscellaneous'), 236 | ] 237 | 238 | # Documents to append as an appendix to all manuals. 239 | #texinfo_appendices = [] 240 | 241 | # If false, no module index is generated. 242 | #texinfo_domain_indices = True 243 | 244 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 245 | #texinfo_show_urls = 'footnote' 246 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. pytest dbfixtures documentation master file, created by 2 | sphinx-quickstart on Sat Jan 25 23:48:05 2014. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to pytest dbfixtures's documentation! 7 | ============================================= 8 | 9 | 10 | .. include:: ../README.rst 11 | 12 | Contents: 13 | 14 | .. toctree:: 15 | :maxdepth: 2 16 | 17 | contributing 18 | changelog 19 | 20 | 21 | Indices and tables 22 | ================== 23 | 24 | * :ref:`genindex` 25 | * :ref:`modindex` 26 | * :ref:`search` 27 | * :ref:`authors` 28 | -------------------------------------------------------------------------------- /pylama.ini: -------------------------------------------------------------------------------- 1 | [pylama] 2 | # add pep257 linter to check docstring conventions 3 | linters = pycodestyle,pyflakes 4 | skip = docs/* 5 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | addopts = --max-slave-restart=0 --showlocals --verbose 3 | -------------------------------------------------------------------------------- /requirements-test.txt: -------------------------------------------------------------------------------- 1 | # test runs requirements (versions we'll be testing against) - automatically updated by requires.io 2 | pylama==7.3.1 3 | pyflakes==1.3.0 4 | pycodestyle==2.2.0 5 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 by Clearcode 2 | # and associates (see AUTHORS). 3 | 4 | # This file is part of pytest-dbfixtures. 5 | 6 | # pytest-dbfixtures is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | 11 | # pytest-dbfixtures is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with pytest-dbfixtures. If not, see . 18 | 19 | import re 20 | import os 21 | from setuptools import setup, find_packages 22 | 23 | 24 | here = os.path.dirname(__file__) 25 | with open( 26 | os.path.join(here, 'src', 'pytest_dbfixtures', '__init__.py') 27 | ) as v_file: 28 | package_version = re.compile( 29 | r".*__version__ = '(.*?)'", re.S).match(v_file.read()).group(1) 30 | 31 | 32 | def read(fname): 33 | """ 34 | Read file's content. 35 | 36 | :param str fname: name of file to read 37 | 38 | :returns: file content 39 | :rtype: str 40 | """ 41 | return open(os.path.join(here, fname)).read() 42 | 43 | 44 | setup( 45 | name='pytest-dbfixtures', 46 | version=package_version, 47 | description='Databases fixtures plugin for py.test.', 48 | long_description=( 49 | read('README.rst') + '\n\n' + read('CHANGES.rst') 50 | ), 51 | author='Clearcode - The A Room', 52 | author_email='thearoom@clearcode.cc', 53 | url='https://github.com/ClearcodeHQ/pytest-dbfixtures', 54 | install_requires=[], 55 | package_dir={'': 'src'}, 56 | packages=find_packages('src'), 57 | include_package_data=True, 58 | extras_require={ 59 | 'mysql': ['pytest-mysql'], 60 | 'postgresql': ['pytest-postgresql'], 61 | 'mongodb': ['pytest-mongo'], 62 | 'elasticsearch': ['pytest-elasticsearch'], 63 | 'redis': ['pytest-redis'], 64 | 'rabbitmq': ['pytest-rabbitmq'], 65 | 'dynamodb': ['pytest-dynamodb'], 66 | }, 67 | entry_points={ 68 | 'pytest11': [ 69 | 'pytest_dbfixtures = pytest_dbfixtures.plugin' 70 | ]}, 71 | keywords='tests py.test pytest fixture redis mongo mongodb' 72 | ' rabbit rabbitmq mysql postgres postgresql' 73 | ' elasticsearch', 74 | license='LGPLv3+', 75 | classifiers=[ 76 | 'Development Status :: 4 - Beta', 77 | 'Intended Audience :: Developers', 78 | 'Operating System :: POSIX', 79 | 'Operating System :: MacOS :: MacOS X', 80 | 'Topic :: Software Development :: Quality Assurance', 81 | 'Topic :: Software Development :: Testing', 82 | 'Topic :: Utilities', 83 | 'License :: OSI Approved :: ' 84 | 'GNU Lesser General Public License v3 or later (LGPLv3+)', 85 | 'Programming Language :: Python', 86 | 'Programming Language :: Python :: 2', 87 | 'Programming Language :: Python :: 2.7', 88 | 'Programming Language :: Python :: 3', 89 | 'Programming Language :: Python :: 3.3', 90 | 'Programming Language :: Python :: 3.4', 91 | 'Programming Language :: Python :: 3.5', 92 | 'Programming Language :: Python :: 3.6', 93 | ] 94 | ) 95 | -------------------------------------------------------------------------------- /src/pytest_dbfixtures/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2013 by Clearcode 2 | # and associates (see AUTHORS). 3 | 4 | # This file is part of pytest-dbfixtures. 5 | 6 | # pytest-dbfixtures is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Lesser General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | 11 | # pytest-dbfixtures is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Lesser General Public License for more details. 15 | 16 | # You should have received a copy of the GNU Lesser General Public License 17 | # along with pytest-dbfixtures. If not, see . 18 | 19 | __version__ = '1.0.0' 20 | --------------------------------------------------------------------------------