diff --git a/Pipfile b/Pipfile index 630f4ec..85ad666 100644 --- a/Pipfile +++ b/Pipfile @@ -4,9 +4,10 @@ url = "https://pypi.org/simple" verify_ssl = true [dev-packages] -nose = "*" coverage = "*" twine = "*" +pytest = "*" +pytest-cov = "*" [packages] urllib3 = ">=2.1.0" diff --git a/Pipfile.lock b/Pipfile.lock index ac5ba73..d1ab4bd 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "2ab50499e986c80ada85e1893167602499fae6cd6d46d2c25ac232c34cb22092" + "sha256": "09dfd0a28da4402be6db03781432fb082e5fe5d6010dae3f98443aa5d336f526" }, "pipfile-spec": 6, "requires": {}, @@ -433,6 +433,9 @@ "version": "==3.3.2" }, "coverage": { + "extras": [ + "toml" + ], "hashes": [ "sha256:04387a4a6ecb330c1878907ce0dc04078ea72a869263e53c72a1ba5bbdf380ca", "sha256:0676cd0ba581e514b7f726495ea75aba3eb20899d824636c6f59b0ed2f88c471", @@ -515,6 +518,14 @@ "markers": "python_version >= '3.8'", "version": "==7.0.1" }, + "iniconfig": { + "hashes": [ + "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", + "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374" + ], + "markers": "python_version >= '3.7'", + "version": "==2.0.0" + }, "jaraco.classes": { "hashes": [ "sha256:10afa92b6743f25c0cf5f37c6bb6e18e2c5bb84a16527ccfc0040ea377e7aaeb", @@ -576,14 +587,13 @@ ], "version": "==0.2.15" }, - "nose": { + "packaging": { "hashes": [ - "sha256:9ff7c6cc443f8c51994b34a667bbcf45afd6d945be7477b52e97516fd17c53ac", - "sha256:dadcddc0aefbf99eea214e0f1232b94f2fa9bd98fa8353711dacb112bfcbbb2a", - "sha256:f1bffef9cbc82628f6e7d7b40d7e255aefaa1adb6a1b1d26c69a8b79e6208a98" + "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5", + "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7" ], - "index": "pypi", - "version": "==1.3.7" + "markers": "python_version >= '3.7'", + "version": "==23.2" }, "pkginfo": { "hashes": [ @@ -593,6 +603,14 @@ "markers": "python_version >= '3.6'", "version": "==1.9.6" }, + "pluggy": { + "hashes": [ + "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12", + "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7" + ], + "markers": "python_version >= '3.8'", + "version": "==1.3.0" + }, "pygments": { "hashes": [ "sha256:b27c2826c47d0f3219f29554824c30c5e8945175d888647acd804ddd04af846c", @@ -601,6 +619,24 @@ "markers": "python_version >= '3.7'", "version": "==2.17.2" }, + "pytest": { + "hashes": [ + "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280", + "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8" + ], + "index": "pypi", + "markers": "python_version >= '3.7'", + "version": "==7.4.4" + }, + "pytest-cov": { + "hashes": [ + "sha256:3904b13dfbfec47f003b8e77fd5b589cd11904a21ddf1ab38a64f204d6a10ef6", + "sha256:6ba70b9e97e69fcc3fb45bfeab2d0a138fb65c4d0d6a41ef33983ad114be8c3a" + ], + "index": "pypi", + "markers": "python_version >= '3.7'", + "version": "==4.1.0" + }, "readme-renderer": { "hashes": [ "sha256:13d039515c1f24de668e2c93f2e877b9dbe6c6c32328b90a40a49d8b2b85f36d", diff --git a/contributing.md b/contributing.md index ae676b0..d2b2641 100644 --- a/contributing.md +++ b/contributing.md @@ -1,10 +1,10 @@ # Contributing -I am accepting pull requests. Sometimes life gets busy and it takes me a little while to get everything merged in. To help speed up the process, please write tests to cover your changes. I will review/merge them as soon as possible. +I am accepting pull requests. Sometimes life gets busy and it takes me a little while to get everything reviewed and merged in. To help speed up the process, please write tests to cover your changes. I will review/merge them as soon as possible. # Testing -I use [nose](https://nose.readthedocs.io/en/latest/index.html) and [Coverage](https://coverage.readthedocs.io/en/latest/) to run the test suite. +I use [pytest](https://docs.pytest.org/en/7.4.x/contents.html), [Coverage](https://coverage.readthedocs.io/en/latest/), and [pytest-cov](https://pytest-cov.readthedocs.io/en/latest/) to run the test suite. *WARNING*: The Tests connect to the QBO API and create/modify/delete data. DO NOT USE A PRODUCTION ACCOUNT! @@ -12,21 +12,24 @@ I use [nose](https://nose.readthedocs.io/en/latest/index.html) and [Coverage](ht 1. Create/login into your [Intuit Developer account](https://developer.intuit.com). 2. On your Intuit Developer account, create a Sandbox company and an App. -3. Go to the Intuit Developer OAuth 2.0 Playground and fill out the form to get an **access token** and **refresh token**. You will need to copy the following values into your enviroment variables: +3. Go to the Intuit Developer OAuth 2.0 Playground and fill out the form to get a **refresh token**. You will need to copy the following values into your enviroment variables: ``` export CLIENT_ID="" export CLIENT_SECRET="" - export COMPANY_ID="" - export ACCESS_TOKEN="" + export COMPANY_ID="" export REFRESH_TOKEN="" ``` - *Note*: You will need to update the access token when it expires. + *Note*: You will need to update the refresh token when it expires. -5. Install *nose* and *coverage*. Using Pip: - `pip install nose coverage` +5. Install *pytest*, *coverage*, and *pytest-cov*. Using Pip (or whatever): + `pip install pytest coverage pytest-cov` -6. Run `nosetests . --with-coverage --cover-package=quickbooks` +6. Run all tests: ```pytest --cov``` + Run only unit tests: ```pytest tests/unit --cov``` + Run only integration tests: ```pytest tests/intergration --cov``` + + ## Creating new tests Normal Unit tests that do not connect to the QBO API should be located under `test/unit` Test that connect to QBO API should go under `tests/integration`. Inheriting from `QuickbooksTestCase` will automatically setup `self.qb_client` to use when connecting to QBO.