From 11a188c7e67e0bf6fc500d606d7760467c98bb01 Mon Sep 17 00:00:00 2001 From: Christoph Zwerschke Date: Sat, 6 Jul 2019 21:00:22 +0200 Subject: [PATCH] Separate tests from library code This makes testing and installing without tests a lot easier. --- .coveragerc | 12 ++ .gitignore | 78 ++++--------- MANIFEST.in | 14 ++- README.md | 28 +++-- graphql_relay/connection/__init__.py | 1 + graphql_relay/connection/tests/__init__.py | 0 graphql_relay/mutation/__init__.py | 1 + graphql_relay/node/__init__.py | 1 + graphql_relay/node/tests/__init__.py | 0 graphql_relay/tests/__init__.py | 0 poetry.lock | 109 ++++++++---------- pyproject.toml | 15 +-- setup.cfg | 1 - setup.py | 53 ++------- tests/__init__.py | 1 + tests/connection/__init__.py | 1 + .../connection}/test_arrayconnection.py | 0 .../connection}/test_connection.py | 0 tests/mutation/__init__.py | 1 + .../tests => tests/mutation}/test_mutation.py | 0 tests/node/__init__.py | 1 + .../node/tests => tests/node}/test_global.py | 0 .../node/tests => tests/node}/test_node.py | 0 .../node/tests => tests/node}/test_plural.py | 0 tests/{starwars/data.py => star_wars_data.py} | 0 .../schema.py => star_wars_schema.py} | 5 +- tests/starwars/__init__.py | 0 ...tions.py => test_star_wars_connections.py} | 2 +- ...tations.py => test_star_wars_mutations.py} | 2 +- ...> test_star_wars_object_identification.py} | 2 +- {graphql_relay/tests => tests}/test_utils.py | 5 +- .../tests => tests}/test_version.py | 0 tox.ini | 14 ++- 33 files changed, 153 insertions(+), 194 deletions(-) create mode 100644 .coveragerc delete mode 100644 graphql_relay/connection/tests/__init__.py delete mode 100644 graphql_relay/node/tests/__init__.py delete mode 100644 graphql_relay/tests/__init__.py create mode 100644 tests/__init__.py create mode 100644 tests/connection/__init__.py rename {graphql_relay/connection/tests => tests/connection}/test_arrayconnection.py (100%) rename {graphql_relay/connection/tests => tests/connection}/test_connection.py (100%) create mode 100644 tests/mutation/__init__.py rename {graphql_relay/mutation/tests => tests/mutation}/test_mutation.py (100%) create mode 100644 tests/node/__init__.py rename {graphql_relay/node/tests => tests/node}/test_global.py (100%) rename {graphql_relay/node/tests => tests/node}/test_node.py (100%) rename {graphql_relay/node/tests => tests/node}/test_plural.py (100%) rename tests/{starwars/data.py => star_wars_data.py} (100%) rename tests/{starwars/schema.py => star_wars_schema.py} (99%) delete mode 100644 tests/starwars/__init__.py rename tests/{starwars/test_connections.py => test_star_wars_connections.py} (94%) rename tests/{starwars/test_mutations.py => test_star_wars_mutations.py} (95%) rename tests/{starwars/test_objectidentification.py => test_star_wars_object_identification.py} (98%) rename {graphql_relay/tests => tests}/test_utils.py (93%) rename {graphql_relay/tests => tests}/test_version.py (100%) diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..25b1c7b --- /dev/null +++ b/.coveragerc @@ -0,0 +1,12 @@ +[run] +branch = True +source = graphql + +[report] +exclude_lines = + pragma: no cover + raise NotImplementedError +ignore_errors = True +omit = + docs/* + tests/* diff --git a/.gitignore b/.gitignore index f55a50f..2b424f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,62 +1,28 @@ -__pycache__/ -*.py[cod] - -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST -*.manifest -*.spec - -pip-log.txt -pip-delete-this-directory.txt - -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* .cache -nosetests.xml -coverage.xml -*.cover -.pytest_cache/ - -*.mo -*.pot - -*.log - -docs/_build/ - -target/ - -.python-version - +.coverage .env +.env.bak +.idea +.mypy_cache +.pytest_cache +.tox .venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ +.venv.bak +.vs + +build +dist +docs/_build +pip-wheel-metadata +wheels -.mypy_cache/ +play -.idea/ +__pycache__ + +*.cover +*.egg +*.egg-info +*.log +*.py[cod] diff --git a/MANIFEST.in b/MANIFEST.in index 8665bad..256418d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,12 +4,18 @@ include CODEOWNERS include LICENSE include README.md +include .coveragerc +include .flake8 + include codecov.yml include tox.ini -graft graphql +include poetry.lock +include pyproject.toml -global-exclude tests/* -recursive-exclude tests * +graft graphql_relay +graft tests +recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif +prune docs/_build -global-exclude *.py[co] __pycache__ \ No newline at end of file +global-exclude *.py[co] __pycache__ diff --git a/README.md b/README.md index 4bf8176..349f7d6 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ GraphQL-relay-py is the [Relay](https://relay.dev/) library for It allows the easy creation of Relay-compliant servers using GraphQL-core. -GraphQL-relay-py is a Python port of +GraphQL-Relay-Py is a Python port of [graphql-relay-js](https://github.com/graphql/graphql-relay-js), -while GraphQL-core is a Python port of +while GraphQL-Core is a Python port of [GraphQL.js](https://github.com/graphql/graphql-js), the reference implementation of GraphQL for JavaScript. -Since version 3, GraphQL-relay-py and GraphQL-core support Python 3.6 and above only. +Since version 3, GraphQL-Relay-Py and GraphQL-Core support Python 3.6 and above only. For older versions of Python, you can use version 2 of these libraries. [![PyPI version](https://badge.fury.io/py/graphql-relay.svg)](https://badge.fury.io/py/graphql-relay) @@ -28,7 +28,7 @@ An overview of GraphQL in general is available in the [Specification for GraphQL](https://github.com/graphql-python/graphql-core). This library is designed to work with the -the [GraphQL-core](https://github.com/graphql-python/graphql-core) +the [GraphQL-Core](https://github.com/graphql-python/graphql-core) Python reference implementation of a GraphQL server. An overview of the functionality that a Relay-compliant GraphQL server should provide @@ -230,14 +230,26 @@ value of `mutation_with_client_mutation_id`. ## Contributing -After cloning this repo, ensure dependencies are installed by running: +After cloning this repository from GitHub, +we recommend using [Poetry](https://poetry.eustace.io/) +to create a test environment. With poetry installed, +you do this with the following command: ```sh -python setup.py install +poetry install ``` -After developing, the full test suite can be evaluated by running: +You can then run the complete test suite like this: ```sh -python setup.py test # Use --pytest-args="-v -s" for verbose mode +poetry run pytest +``` + +Use [tox](https://tox.readthedocs.io/) to run the test suite with different +Python versions and perform additional testing on the code base. You need +to install and run tox separately, as it uses its own virtual environments. +You can also restrict tox to an individual environment, like this: + +```sh +tox -e py37 ``` diff --git a/graphql_relay/connection/__init__.py b/graphql_relay/connection/__init__.py index e69de29..7668785 100644 --- a/graphql_relay/connection/__init__.py +++ b/graphql_relay/connection/__init__.py @@ -0,0 +1 @@ +"""graphql_relay.connection""" diff --git a/graphql_relay/connection/tests/__init__.py b/graphql_relay/connection/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/graphql_relay/mutation/__init__.py b/graphql_relay/mutation/__init__.py index e69de29..b198fb1 100644 --- a/graphql_relay/mutation/__init__.py +++ b/graphql_relay/mutation/__init__.py @@ -0,0 +1 @@ +"""graphql_relay.mutation""" diff --git a/graphql_relay/node/__init__.py b/graphql_relay/node/__init__.py index e69de29..21b42c6 100644 --- a/graphql_relay/node/__init__.py +++ b/graphql_relay/node/__init__.py @@ -0,0 +1 @@ +"""graphql_relay.node""" diff --git a/graphql_relay/node/tests/__init__.py b/graphql_relay/node/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/graphql_relay/tests/__init__.py b/graphql_relay/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/poetry.lock b/poetry.lock index d137646..e143069 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,3 +1,11 @@ +[[package]] +category = "dev" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +name = "appdirs" +optional = false +python-versions = "*" +version = "1.4.3" + [[package]] category = "dev" description = "Atomic file writes." @@ -14,6 +22,20 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "19.1.0" +[[package]] +category = "dev" +description = "The uncompromising code formatter." +name = "black" +optional = false +python-versions = ">=3.6" +version = "19.3b0" + +[package.dependencies] +appdirs = "*" +attrs = ">=18.1.0" +click = ">=6.5" +toml = ">=0.9.4" + [[package]] category = "dev" description = "Python package for providing Mozilla's CA Bundle." @@ -30,6 +52,25 @@ optional = false python-versions = "*" version = "3.0.4" +[[package]] +category = "dev" +description = "Check MANIFEST.in in a Python source package for completeness" +name = "check-manifest" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "0.39" + +[package.dependencies] +toml = "*" + +[[package]] +category = "dev" +description = "Composable command line interface toolkit" +name = "click" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "7.0" + [[package]] category = "dev" description = "Hosted coverage reports for Github, Bitbucket and Gitlab" @@ -67,14 +108,6 @@ optional = false python-versions = ">=2.7" version = "0.3" -[[package]] -category = "dev" -description = "A platform independent file lock." -name = "filelock" -optional = false -python-versions = "*" -version = "3.0.12" - [[package]] category = "dev" description = "the modular source code checker: pep8, pyflakes and co" @@ -119,7 +152,6 @@ version = "0.6.1" [[package]] category = "dev" description = "More routines for operating on iterables, beyond itertools" -marker = "python_version > \"2.7\"" name = "more-itertools" optional = false python-versions = ">=3.4" @@ -185,24 +217,20 @@ category = "dev" description = "pytest: simple powerful testing with Python" name = "pytest" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "4.6.3" +python-versions = ">=3.5" +version = "5.0.1" [package.dependencies] atomicwrites = ">=1.0" attrs = ">=17.4.0" colorama = "*" importlib-metadata = ">=0.12" +more-itertools = ">=4.0.0" packaging = "*" pluggy = ">=0.12,<1.0" py = ">=1.5.0" -six = ">=1.10.0" wcwidth = "*" -[package.dependencies.more-itertools] -python = ">=2.8" -version = ">=4.0.0" - [[package]] category = "dev" description = "Pytest support for asyncio." @@ -226,17 +254,6 @@ version = "2.7.1" coverage = ">=4.4" pytest = ">=3.6" -[[package]] -category = "dev" -description = "Describe-style plugin for pytest" -name = "pytest-describe" -optional = false -python-versions = "*" -version = "0.12.0" - -[package.dependencies] -pytest = ">=2.6.0" - [[package]] category = "dev" description = "YAML parser and emitter for Python" @@ -275,24 +292,6 @@ optional = false python-versions = "*" version = "0.10.0" -[[package]] -category = "dev" -description = "tox is a generic virtualenv management and test command line tool" -name = "tox" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "3.13.1" - -[package.dependencies] -filelock = ">=3.0.0,<4" -importlib-metadata = ">=0.12,<1" -packaging = ">=14" -pluggy = ">=0.12.0,<1" -py = ">=1.4.17,<2" -six = ">=1.0.0,<2" -toml = ">=0.9.4" -virtualenv = ">=14.0.0" - [[package]] category = "dev" description = "HTTP library with thread-safe connection pooling, file post, and more." @@ -301,14 +300,6 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4" version = "1.25.3" -[[package]] -category = "dev" -description = "Virtual Python Environment builder" -name = "virtualenv" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "16.6.1" - [[package]] category = "dev" description = "Measures number of Terminal column cells of wide-character codes" @@ -326,19 +317,22 @@ python-versions = ">=2.7" version = "0.5.1" [metadata] -content-hash = "6c5b96ac549bddbf762e43b4e81fb3caf167f25734fe49dfb5c69fe8f99e6f43" +content-hash = "2d2c86356d3ea9e2eae12d16a2805ace877724a70dfcf02d588e98b2800f7c6e" python-versions = "^3.6" [metadata.hashes] +appdirs = ["9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92", "d8b24664561d0d34ddfaec54636d502d7cea6e29c3eaf68f3df6180863e2166e"] atomicwrites = ["03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4", "75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6"] attrs = ["69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79", "f0b870f674851ecbfbbbd364d6b5cbdff9dcedbc7f3f5e18a6891057f21fe399"] +black = ["09a9dcb7c46ed496a9850b76e4e825d6049ecd38b611f1224857a79bd985a8cf", "68950ffd4d9169716bcb8719a56c07a2f4485354fec061cdd5910aa07369731c"] certifi = ["046832c04d4e752f37383b628bc601a7ea7211496b4638f6514d0e5b9acc4939", "945e3ba63a0b9f577b1395204e13c3a231f9bc0223888be653286534e5873695"] chardet = ["84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", "fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"] +check-manifest = ["8754cc8efd7c062a3705b442d1c23ff702d4477b41a269c2e354b25e1f5535a4", "a4c555f658a7c135b8a22bd26c2e55cfaf5876e4d5962d8c25652f2addd556bc"] +click = ["2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", "5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"] codecov = ["8ed8b7c6791010d359baed66f84f061bba5bd41174bf324c31311e8737602788", "ae00d68e18d8a20e9c3288ba3875ae03db3a8e892115bf9b83ef20507732bed4"] colorama = ["05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d", "f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48"] coverage = ["0c5fe441b9cfdab64719f24e9684502a59432df7570521563d7b1aff27ac755f", "2b412abc4c7d6e019ce7c27cbc229783035eef6d5401695dccba80f481be4eb3", "3684fabf6b87a369017756b551cef29e505cb155ddb892a7a29277b978da88b9", "39e088da9b284f1bd17c750ac672103779f7954ce6125fd4382134ac8d152d74", "3c205bc11cc4fcc57b761c2da73b9b72a59f8d5ca89979afb0c1c6f9e53c7390", "42692db854d13c6c5e9541b6ffe0fe921fe16c9c446358d642ccae1462582d3b", "465ce53a8c0f3a7950dfb836438442f833cf6663d407f37d8c52fe7b6e56d7e8", "48020e343fc40f72a442c8a1334284620f81295256a6b6ca6d8aa1350c763bbe", "4ec30ade438d1711562f3786bea33a9da6107414aed60a5daa974d50a8c2c351", "5296fc86ab612ec12394565c500b412a43b328b3907c0d14358950d06fd83baf", "5f61bed2f7d9b6a9ab935150a6b23d7f84b8055524e7be7715b6513f3328138e", "6899797ac384b239ce1926f3cb86ffc19996f6fa3a1efbb23cb49e0c12d8c18c", "68a43a9f9f83693ce0414d17e019daee7ab3f7113a70c79a3dd4c2f704e4d741", "6b8033d47fe22506856fe450470ccb1d8ba1ffb8463494a15cfc96392a288c09", "7ad7536066b28863e5835e8cfeaa794b7fe352d99a8cded9f43d1161be8e9fbd", "7bacb89ccf4bedb30b277e96e4cc68cd1369ca6841bde7b005191b54d3dd1034", "839dc7c36501254e14331bcb98b27002aa415e4af7ea039d9009409b9d2d5420", "8e679d1bde5e2de4a909efb071f14b472a678b788904440779d2c449c0355b27", "8f9a95b66969cdea53ec992ecea5406c5bd99c9221f539bca1e8406b200ae98c", "932c03d2d565f75961ba1d3cec41ddde00e162c5b46d03f7423edcb807734eab", "93f965415cc51604f571e491f280cff0f5be35895b4eb5e55b47ae90c02a497b", "988529edadc49039d205e0aa6ce049c5ccda4acb2d6c3c5c550c17e8c02c05ba", "998d7e73548fe395eeb294495a04d38942edb66d1fa61eb70418871bc621227e", "9de60893fb447d1e797f6bf08fdf0dbcda0c1e34c1b06c92bd3a363c0ea8c609", "9e80d45d0c7fcee54e22771db7f1b0b126fb4a6c0a2e5afa72f66827207ff2f2", "a545a3dfe5082dc8e8c3eb7f8a2cf4f2870902ff1860bd99b6198cfd1f9d1f49", "a5d8f29e5ec661143621a8f4de51adfb300d7a476224156a39a392254f70687b", "a9abc8c480e103dc05d9b332c6cc9fb1586330356fc14f1aa9c0ca5745097d19", "aca06bfba4759bbdb09bf52ebb15ae20268ee1f6747417837926fae990ebc41d", "bb23b7a6fd666e551a3094ab896a57809e010059540ad20acbeec03a154224ce", "bfd1d0ae7e292105f29d7deaa9d8f2916ed8553ab9d5f39ec65bcf5deadff3f9", "c22ab9f96cbaff05c6a84e20ec856383d27eae09e511d3e6ac4479489195861d", "c62ca0a38958f541a73cf86acdab020c2091631c137bd359c4f5bddde7b75fd4", "c709d8bda72cf4cd348ccec2a4881f2c5848fd72903c185f363d361b2737f773", "c968a6aa7e0b56ecbd28531ddf439c2ec103610d3e2bf3b75b813304f8cb7723", "ca58eba39c68010d7e87a823f22a081b5290e3e3c64714aac3c91481d8b34d22", "df785d8cb80539d0b55fd47183264b7002077859028dfe3070cf6359bf8b2d9c", "f406628ca51e0ae90ae76ea8398677a921b36f0bd71aab2099dfed08abd0322f", "f46087bbd95ebae244a0eda01a618aff11ec7a069b15a3ef8f6b520db523dcf1", "f8019c5279eb32360ca03e9fac40a12667715546eed5c5eb59eb381f2f501260", "fc5f4d209733750afd2714e9109816a29500718b32dd9a5db01c0cb3a019b96a"] entrypoints = ["589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19", "c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451"] -filelock = ["18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59", "929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"] flake8 = ["859996073f341f2670741b51ec1e67a01da142831aa1fdc6242dbf88dffbe661", "a796a115208f5c03b18f332f7c11729812c8c3ded6c46319c59b53efd3819da8"] idna = ["c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", "ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c"] importlib-metadata = ["6dfd58dfe281e8d240937776065dd3624ad5469c835248219bd16cf2e12dbeb7", "cb6ee23b46173539939964df59d3d72c3e0c1b5d54b84f1d8a7e912fe43612db"] @@ -350,16 +344,13 @@ py = ["64f65755aee5b381cea27766a3a147c3f15b9b6b9ac88676de66ba2ae36793fa", "dc639 pycodestyle = ["95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56", "e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c"] pyflakes = ["17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0", "d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2"] pyparsing = ["1873c03321fc118f4e9746baf201ff990ceb915f433f23b395f5580d1840cb2a", "9b6323ef4ab914af344ba97510e966d64ba91055d6b9afa6b30799340e89cc03"] -pytest = ["4a784f1d4f2ef198fe9b7aef793e9fa1a3b2f84e822d9b3a64a181293a572d45", "926855726d8ae8371803f7b2e6ec0a69953d9c6311fa7c3b6c1b929ff92d27da"] +pytest = ["6ef6d06de77ce2961156013e9dff62f1b2688aa04d0dc244299fe7d67e09370d", "a736fed91c12681a7b34617c8fcefe39ea04599ca72c608751c31d89579a3f77"] pytest-asyncio = ["9fac5100fd716cbecf6ef89233e8590a4ad61d729d1732e0a96b84182df1daaf", "d734718e25cfc32d2bf78d346e99d33724deeba774cc4afdf491530c6184b63b"] pytest-cov = ["2b097cde81a302e1047331b48cadacf23577e431b61e9c6f49a1170bbe3d3da6", "e00ea4fdde970725482f1f35630d12f074e121a23801aabf2ae154ec6bdd343a"] -pytest-describe = ["569bda96401fe512f4f345f33fd23fa4d718639d42afac62bc03254b5f2b3fdf"] pyyaml = ["57acc1d8533cbe51f6662a55434f0dbecfa2b9eaf115bede8f6fd00115a0c0d3", "588c94b3d16b76cfed8e0be54932e5729cc185caffaa5a451e7ad2f7ed8b4043", "68c8dd247f29f9a0d09375c9c6b8fdc64b60810ebf07ba4cdd64ceee3a58c7b7", "70d9818f1c9cd5c48bb87804f2efc8692f1023dac7f1a1a5c61d454043c1d265", "86a93cccd50f8c125286e637328ff4eef108400dd7089b46a7be3445eecfa391", "a0f329125a926876f647c9fa0ef32801587a12328b4a3c741270464e3e4fa778", "a3c252ab0fa1bb0d5a3f6449a4826732f3eb6c0270925548cac342bc9b22c225", "b4bb4d3f5e232425e25dda21c070ce05168a786ac9eda43768ab7f3ac2770955", "cd0618c5ba5bda5f4039b9398bb7fb6a317bb8298218c3de25c47c4740e4b95e", "ceacb9e5f8474dcf45b940578591c7f3d960e82f926c707788a570b51ba59190", "fe6a88094b64132c4bb3b631412e90032e8cfe9745a58370462240b8cb7553cd"] requests = ["11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4", "9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31"] six = ["3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"] toml = ["229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c", "235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e", "f1db651f9657708513243e61e6cc67d101a39bad662eaa9b5546f789338e07a3"] -tox = ["45a265e953368fb372cca3eac33b69fdb1b1453e5b114be231c84fc3dfadceed", "f5cb0b5b8d14f2100982b0981c750d840228180a348e6bad355aa38e949fbc3f"] urllib3 = ["b246607a25ac80bedac05c6f282e3cdaf3afb65420fd024ac94435cabe6e18d1", "dbe59173209418ae49d485b87d1681aefa36252ee85884c31346debd19463232"] -virtualenv = ["b7335cddd9260a3dd214b73a2521ffc09647bde3e9457fcca31dc3be3999d04a", "d28ca64c0f3f125f59cabf13e0a150e1c68e5eea60983cc4395d88c584495783"] wcwidth = ["3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e", "f4ebe71925af7b40a864553f761ed559b43544f8f71746c2d756c7fe788ade7c"] zipp = ["8c1019c6aad13642199fbe458275ad6a84907634cc9f0989877ccc4a2840139d", "ca943a7e809cc12257001ccfb99e3563da9af99d52f261725e96dfe0f9275bc3"] diff --git a/pyproject.toml b/pyproject.toml index 05548be..483469d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "graphql-relay" -version = "1.0.0a0" +version = "3.0.0a0" description = """ Relay library for graphql-core-next""" licese="MIT" @@ -16,6 +16,7 @@ keywords="graphql relay api" classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", @@ -27,20 +28,20 @@ packages = [ [tool.poetry.dependencies] python = "^3.6" +graphql-core-next = "^1.0.5" [tool.poetry.dev-dependencies] -pytest = "^4.6" -pytest-asyncio = "^0.10" +pytest = "^5" +pytest-asyncio = ">=0.10" pytest-cov = "^2.7" -pytest-describe = "^0.12" pyyaml = "^5.1" +black = ">=19.3b0" flake8 = "^3.7" -tox = "^3.12" -codecov = "^2.0" +codecov = "^2" +check-manifest = ">=0.39" [tool.black] target-version = ['py36', 'py37', 'py38'] [build-system] requires = ["poetry>=0.12.16"] build-backend = "poetry.masonry.api" - diff --git a/setup.cfg b/setup.cfg index 4183944..7daeda0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,4 +3,3 @@ python-tag = py3 [aliases] test = pytest - diff --git a/setup.py b/setup.py index 6a59532..39506fc 100644 --- a/setup.py +++ b/setup.py @@ -1,70 +1,35 @@ -import sys from re import search - from setuptools import setup, find_packages -from setuptools.command.test import test as TestCommand -with open("graphql_relay/version.py") as version_file: +with open('graphql_relay/version.py') as version_file: version = search('version = "(.*)"', version_file.read()).group(1) -with open("README.md") as readme_file: +with open('README.md') as readme_file: readme = readme_file.read() - -class PyTest(TestCommand): - user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] - - def initialize_options(self): - TestCommand.initialize_options(self) - self.pytest_args = [] - - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = [] - self.test_suite = True - - def run_tests(self): - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(self.pytest_args) - sys.exit(errno) - - setup( name='graphql-relay', version=version, - description='Relay library for graphql-core-next', long_description=readme, - long_description_content_type="text/markdown", - + long_description_content_type='text/markdown', + keywords='graphql relay api', url='https://github.com/graphql-python/graphql-relay-py', - author='Syrus Akbary', author_email='me@syrusakbary.com', - license='MIT', - classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'Topic :: Software Development :: Libraries', - "License :: OSI Approved :: MIT License", + 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: PyPy', ], - - keywords='graphql relay api', - - packages=find_packages(exclude=['tests']), - - install_requires=[ - 'graphql-core-next>=1.0.5', - ], - tests_require=['pytest>=5', 'pytest-asyncio>=0.10'], - extras_require={}, - - cmdclass={'test': PyTest}, + install_requires=['graphql-core-next>=1.0.5'], + python_requires='>=3.6', + packages=find_packages(include=['graphql_relay']), + zip_safe=False, ) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..537c3ef --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1 @@ +"""Tests for graphql_relay""" diff --git a/tests/connection/__init__.py b/tests/connection/__init__.py new file mode 100644 index 0000000..2bd2ffa --- /dev/null +++ b/tests/connection/__init__.py @@ -0,0 +1 @@ +"""Tests for graphql_relay.connection""" diff --git a/graphql_relay/connection/tests/test_arrayconnection.py b/tests/connection/test_arrayconnection.py similarity index 100% rename from graphql_relay/connection/tests/test_arrayconnection.py rename to tests/connection/test_arrayconnection.py diff --git a/graphql_relay/connection/tests/test_connection.py b/tests/connection/test_connection.py similarity index 100% rename from graphql_relay/connection/tests/test_connection.py rename to tests/connection/test_connection.py diff --git a/tests/mutation/__init__.py b/tests/mutation/__init__.py new file mode 100644 index 0000000..61f885c --- /dev/null +++ b/tests/mutation/__init__.py @@ -0,0 +1 @@ +"""Tests for graphql_relay.mutation""" diff --git a/graphql_relay/mutation/tests/test_mutation.py b/tests/mutation/test_mutation.py similarity index 100% rename from graphql_relay/mutation/tests/test_mutation.py rename to tests/mutation/test_mutation.py diff --git a/tests/node/__init__.py b/tests/node/__init__.py new file mode 100644 index 0000000..73e9152 --- /dev/null +++ b/tests/node/__init__.py @@ -0,0 +1 @@ +"""Tests for graphql_relay.node""" diff --git a/graphql_relay/node/tests/test_global.py b/tests/node/test_global.py similarity index 100% rename from graphql_relay/node/tests/test_global.py rename to tests/node/test_global.py diff --git a/graphql_relay/node/tests/test_node.py b/tests/node/test_node.py similarity index 100% rename from graphql_relay/node/tests/test_node.py rename to tests/node/test_node.py diff --git a/graphql_relay/node/tests/test_plural.py b/tests/node/test_plural.py similarity index 100% rename from graphql_relay/node/tests/test_plural.py rename to tests/node/test_plural.py diff --git a/tests/starwars/data.py b/tests/star_wars_data.py similarity index 100% rename from tests/starwars/data.py rename to tests/star_wars_data.py diff --git a/tests/starwars/schema.py b/tests/star_wars_schema.py similarity index 99% rename from tests/starwars/schema.py rename to tests/star_wars_schema.py index d9e90f6..b391ab2 100644 --- a/tests/starwars/schema.py +++ b/tests/star_wars_schema.py @@ -13,21 +13,18 @@ global_id_field, from_global_id ) - from graphql_relay.connection.arrayconnection import ( connection_from_list ) - from graphql_relay.connection.connection import ( connection_args, connection_definitions ) - from graphql_relay.mutation.mutation import ( mutation_with_client_mutation_id ) -from .data import ( +from .star_wars_data import ( Faction, getFaction, getShip, diff --git a/tests/starwars/__init__.py b/tests/starwars/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/starwars/test_connections.py b/tests/test_star_wars_connections.py similarity index 94% rename from tests/starwars/test_connections.py rename to tests/test_star_wars_connections.py index fe76518..77889f3 100644 --- a/tests/starwars/test_connections.py +++ b/tests/test_star_wars_connections.py @@ -2,7 +2,7 @@ from graphql import graphql -from .schema import StarWarsSchema +from .star_wars_schema import StarWarsSchema @mark.asyncio diff --git a/tests/starwars/test_mutations.py b/tests/test_star_wars_mutations.py similarity index 95% rename from tests/starwars/test_mutations.py rename to tests/test_star_wars_mutations.py index 45799f2..0d664f6 100644 --- a/tests/starwars/test_mutations.py +++ b/tests/test_star_wars_mutations.py @@ -2,7 +2,7 @@ from graphql import graphql -from .schema import StarWarsSchema +from .star_wars_schema import StarWarsSchema @mark.asyncio diff --git a/tests/starwars/test_objectidentification.py b/tests/test_star_wars_object_identification.py similarity index 98% rename from tests/starwars/test_objectidentification.py rename to tests/test_star_wars_object_identification.py index 36813bc..6a1fc47 100644 --- a/tests/starwars/test_objectidentification.py +++ b/tests/test_star_wars_object_identification.py @@ -2,7 +2,7 @@ from graphql import graphql -from .schema import StarWarsSchema +from .star_wars_schema import StarWarsSchema @mark.asyncio diff --git a/graphql_relay/tests/test_utils.py b/tests/test_utils.py similarity index 93% rename from graphql_relay/tests/test_utils.py rename to tests/test_utils.py index 982c8a9..a2deb55 100644 --- a/graphql_relay/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,9 +1,6 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - import base64 -from .. import utils +from graphql_relay import utils def test_base64_encode_unicode_strings_correctly(): diff --git a/graphql_relay/tests/test_version.py b/tests/test_version.py similarity index 100% rename from graphql_relay/tests/test_version.py rename to tests/test_version.py diff --git a/tox.ini b/tox.ini index f2f0d02..39fbb97 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{36,37}, flake8 +envlist = py{36,37}, flake8, manifest [testenv:flake8] basepython = python3.7 @@ -7,12 +7,18 @@ deps = flake8>=3.7 commands = flake8 graphql_relay tests +[testenv:manifest] +basepython = python3.7 +deps = check-manifest>=0.39 +commands = + check-manifest -v + [testenv] setenv = PYTHONPATH = {toxinidir} deps = - pytest>=5.0 + pytest>=5.0,<6 pytest-asyncio>=0.10 - pytest-cov>=2.7 + pytest-cov>=2.7,<3 commands = - pytest graphql_relay tests {posargs} + pytest tests {posargs}