Przeglądaj źródła

Correct path within sphinx config

Also update testing docs to show spec output.
master
David Winterbottom 13 lat temu
rodzic
commit
ae2ca25bdc
2 zmienionych plików z 35 dodań i 6 usunięć
  1. 8
    3
      docs/source/conf.py
  2. 27
    3
      docs/source/contributing.rst

+ 8
- 3
docs/source/conf.py Wyświetl plik

@@ -15,12 +15,17 @@
15 15
 # add these directories to sys.path here. If the directory is relative to the
16 16
 # documentation root, use os.path.abspath to make it absolute, like shown here.
17 17
 #sys.path.insert(0, os.path.abspath('.'))
18
-import sys, os
19
-oscar_folder = os.path.realpath(os.path.join(os.path.dirname(__file__), '../..'))
18
+import sys
19
+import os
20
+oscar_folder = os.path.realpath(
21
+    os.path.join(os.path.dirname(__file__), '../..'))
22
+sandbox_folder = os.path.realpath(
23
+    os.path.join(os.path.dirname(__file__), '../../sites/sandbox'))
20 24
 sys.path.append(oscar_folder)
25
+sys.path.append(sandbox_folder)
21 26
 
22 27
 # Get django settings
23
-os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sandbox.settings')
28
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
24 29
 
25 30
 # -- General configuration -----------------------------------------------------
26 31
 

+ 27
- 3
docs/source/contributing.rst Wyświetl plik

@@ -30,10 +30,10 @@ Running tests
30 30
 
31 31
 Oscar uses a nose_ testrunner which can be invoked using::
32 32
 
33
-.. _nose: http://nose.readthedocs.org/en/latest/
34
-
35 33
     ./runtests.py
36 34
 
35
+.. _nose: http://nose.readthedocs.org/en/latest/
36
+
37 37
 To run a subset of tests, you can use filesystem or module paths.  These two
38 38
 commands will run the same set of tests::
39 39
 
@@ -54,7 +54,31 @@ To run an individual test, use one of::
54 54
 
55 55
 Oscar's testrunner uses the progressive_ plugin when running all tests, but uses
56 56
 the spec_ plugin when running a subset.  It is a good practice to name your test
57
-cases and methods so that the spec output reads correctly.
57
+cases and methods so that the spec output reads correctly.  For example::
58
+
59
+    $ ./runtests.py tests/unit/offer/benefit_tests.py:TestAbsoluteDiscount
60
+    nosetests --verbosity 1 tests/unit/offer/benefit_tests.py:TestAbsoluteDiscount -s -x --with-spec
61
+    Creating test database for alias 'default'...
62
+
63
+    Absolute discount
64
+    - consumes all lines for multi item basket cheaper than threshold
65
+    - consumes all products for heterogeneous basket
66
+    - consumes correct quantity for multi item basket more expensive than threshold
67
+    - correctly discounts line
68
+    - discount is applied to lines
69
+    - gives correct discount for multi item basket cheaper than threshold
70
+    - gives correct discount for multi item basket more expensive than threshold
71
+    - gives correct discount for multi item basket with max affected items set
72
+    - gives correct discount for single item basket cheaper than threshold
73
+    - gives correct discount for single item basket equal to threshold
74
+    - gives correct discount for single item basket more expensive than threshold
75
+    - gives correct discounts when applied multiple times
76
+    - gives correct discounts when applied multiple times with condition
77
+    - gives no discount for a non discountable product
78
+    - gives no discount for an empty basket
79
+
80
+    ----------------------------------------------------------------------
81
+    Ran 15 tests in 0.295s
58 82
 
59 83
 .. _progressive: http://pypi.python.org/pypi/nose-progressive/
60 84
 .. _spec: http://darcs.idyll.org/~t/projects/pinocchio/doc/#spec-generate-test-description-from-test-class-method-names

Ładowanie…
Anuluj
Zapisz