Skip to content

Commit

Permalink
Move to pytest based tests and make use of multiple CPUs
Browse files Browse the repository at this point in the history
From what I’ve seen the average test time is down to about 20% of
what the old test suite took to run.
  • Loading branch information
jacobsvante committed Dec 7, 2016
1 parent 4eed74f commit 4f2b819
Show file tree
Hide file tree
Showing 10 changed files with 726 additions and 448 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@ local_settings.py

# pypi building stuff
MANIFEST
.cache/
dist/
dist/*
build/
Expand All @@ -18,5 +19,8 @@ build/*
.idea
*.iml

# Sublime Text
*.sublime-*

# testing/tox
.tox/
28 changes: 21 additions & 7 deletions .travis.yml
@@ -1,10 +1,24 @@
language: python
python:
- "2.6"
- "2.7"
- "3.4"
- "3.5"

install: "pip install -r requirements.txt"
matrix:
include:
- python: 2.6
env:
- TOXENV='py26'
- python: 2.7
env:
- TOXENV='py27'
- python: 3.3
env:
- TOXENV='py33'
- python: 3.5
env:
- TOXENV='py35'
- python: 3.5
env:
- TOXENV='lint'

script: python setup.py test
install:
- pip install tox

script: tox
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -398,7 +398,7 @@ api.render('tem_12345', { "amount": "$12.00" }, 'French-Version', strict=False)
403

## to run tests
python setup.py test
tox

### Testing multiple python versions
This assumes you have [tox](https://testrun.org/tox/latest/) installed and used
Expand All @@ -411,4 +411,4 @@ Once all the supported python versions are installed simply run:
This will run the tests against all the versions specified in `tox.ini`.

### packaging (internal)
python setup.py sdist upload
python setup.py sdist bdist_wheel upload
92 changes: 92 additions & 0 deletions conftest.py
@@ -0,0 +1,92 @@
import pytest
import sendwithus


@pytest.fixture
def api_key():
return 'THIS_IS_A_TEST_API_KEY'


@pytest.fixture
def api_options():
return {'DEBUG': False}


@pytest.fixture
def api(api_key, api_options):
return sendwithus.api(api_key, **api_options)


@pytest.fixture
def email_id():
return 'test_fixture_1'


@pytest.fixture
def email_address():
return 'person@example.com'


@pytest.fixture
def segment_id():
return 'seg_VC8FDxDno9X64iUPDFSd76'


@pytest.fixture
def enabled_drip_campaign_id():
return 'dc_Rmd7y5oUJ3tn86sPJ8ESCk'


@pytest.fixture
def disabled_drip_campaign_id():
return 'dc_AjR6Ue9PHPFYmEu2gd8x5V'


@pytest.fixture
def drip_campaign_step_id():
return 'dcs_yaAMiZNWCLAEGw7GLjBuGY'


@pytest.fixture
def recipient():
return {
'name': 'Matt',
'address': 'us@sendwithus.com'
}


@pytest.fixture
def email_data():
return {
'name': 'Jimmy',
'plants': ['Tree', 'Bush', 'Shrub']
}


@pytest.fixture
def sender():
return {
'name': 'Company',
'address': 'company@company.com',
'reply_to': 'info@company.com'
}


@pytest.fixture
def cc_test():
return [
{
'name': 'Matt CC',
'address': 'test+cc@sendwithus.com'
}
]


@pytest.fixture
def bcc_test():
return [
{
'name': 'Matt BCC',
'address': 'test+bcc@sendwithus.com'
}
]
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

0 comments on commit 4f2b819

Please sign in to comment.