Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ecommerce
Commits
cf3da404
Commit
cf3da404
authored
May 08, 2018
by
christopher lee
Committed by
Christopher Lee
May 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow pytest to be run locally
parent
c714e08c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
0 deletions
+27
-0
conftest.py
+17
-0
docs/test_ecommerce.rst
+6
-0
ecommerce/tests/mixins.py
+1
-0
pytest.ini
+3
-0
No files found.
conftest.py
0 → 100644
View file @
cf3da404
"""
Set up for running pytest
Pytest is faster than running `./manage.py test` since it will not create a
database. If a test has database dependencies, that test will not pass.
"""
import
django
def
pytest_configure
(
config
):
print
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
print
(
"! WARNING: Not all tests pass with pytest. Pytest does not create a !
\n
"
"! database. If a test has database dependencies, that test will not !
\n
"
"! pass. !"
)
print
(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
)
django
.
setup
()
docs/test_ecommerce.rst
View file @
cf3da404
...
...
@@ -101,6 +101,12 @@ these models, which are used for multi-tenancy.
ecommerce.courses.tests.test_utils --settings=ecommerce.settings.test
--with-ignore-docstrings --logging-level=DEBUG
* To run tests without creating a database (i.e. really fast), use pytest.
If a test has a database dependency, the test will not pass.
.. code-block:: bash
$ pytest path_to_test
JavaScript Unit Tests
**********************
...
...
ecommerce/tests/mixins.py
View file @
cf3da404
...
...
@@ -255,6 +255,7 @@ class SiteMixin(object):
domain
=
'testserver.fake'
self
.
client
=
self
.
client_class
(
SERVER_NAME
=
domain
)
Partner
.
objects
.
all
()
.
delete
()
Site
.
objects
.
all
()
.
delete
()
self
.
site_configuration
=
SiteConfigurationFactory
(
from_email
=
'from@example.com'
,
...
...
pytest.ini
0 → 100644
View file @
cf3da404
[pytest]
DJANGO_SETTINGS_MODULE
=
ecommerce.settings.test
testpaths
=
ecommerce
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment