File tree Expand file tree Collapse file tree 10 files changed +168
-1
lines changed Expand file tree Collapse file tree 10 files changed +168
-1
lines changed Original file line number Diff line number Diff line change 22All notable changes to this project will be documented in this file.
33This project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
44
5- ## [ 0.1.0] - under development
5+ ## [ 0.1.0] - 2016-04-01
6+ - initial working version
Original file line number Diff line number Diff line change @@ -36,3 +36,30 @@ Test method providing the feedback message and starting with `test_`
3636 def test_a_is_not_one(self):
3737 assert a == 1
3838 # fails with message "a is not one"
39+
40+
41+ ##### Loading Workspace Files
42+
43+ Workspace files (created by the user) can be loaded inside of comments
44+
45+ # load('file.py')
46+
47+ These files will be loaded from the users working directory.
48+
49+ ##### Loading Data Files
50+
51+ Data files can be by setting a second parameter to ` true ` .
52+
53+ # load('path/to/data.py', true)
54+
55+ These files will load from the specified tutorial directory in * package.json* .
56+
57+ * package.json*
58+
59+ config {
60+ tutorialDir: 'tutorial'
61+ }
62+
63+ ##### Complete Example
64+
65+ See the [ examples] ( //github.com/coderoad/pytest-coderoad ) directory.
Original file line number Diff line number Diff line change 1+ # PyTest Demo
2+
3+ A demo for testing Python's PyTest in CodeRoad.
4+
5+
6+ ## CodeRoad
7+
8+ CodeRoad is an open-sourced interactive tutorial platform for the Atom Editor. Learn more at [ CodeRoad.io] ( http://coderoad.io ) .
9+
10+
11+ ## Setup
12+
13+ * install the tutorial package
14+
15+ ` npm install --save coderoad-pytest-demo `
16+
17+ * install and run the [ atom-coderoad] ( https://github.com/coderoad/atom-coderoad ) plugin
18+
19+
20+ ## Outline
21+
22+ ### Basic
23+
24+ Some basic tests to try out PyTest.
25+
26+ ##### Math
27+
28+ Some basic math.
Original file line number Diff line number Diff line change 1+ {
2+ "project" : {
3+ "title" : " PyTest Demo" ,
4+ "description" : " A demo for testing Python's PyTest in CodeRoad."
5+ },
6+ "chapters" : [
7+ {
8+ "title" : " Basic" ,
9+ "description" : " Some basic tests to try out PyTest." ,
10+ "pages" : [
11+ {
12+ "title" : " Math" ,
13+ "description" : " Some basic math.\n\n Addition:\n `1 + 1 == 2`\n\n Subtraction:\n `2 - 1 == 1`" ,
14+ "tasks" : [
15+ {
16+ "description" : " This test should pass automatically." ,
17+ "tests" : [
18+ " 1/01/01-add"
19+ ],
20+ "actions" : [
21+ " open('math.py')" ,
22+ " set('# add')"
23+ ]
24+ },
25+ {
26+ "description" : " This test should also pass automatically" ,
27+ "tests" : [
28+ " 1/01/02-subtract"
29+ ],
30+ "actions" : [
31+ " insert('# subtract')"
32+ ]
33+ },
34+ {
35+ "description" : " Set a variable `a` to 1" ,
36+ "tests" : [
37+ " 1/01/03-value"
38+ ],
39+ "actions" : [
40+ " insert('# value')"
41+ ]
42+ }
43+ ]
44+ }
45+ ]
46+ }
47+ ]
48+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " coderoad-pytest-demo" ,
3+ "version" : " 0.1.0" ,
4+ "description" : " Demo for pytest runner" ,
5+ "main" : " coderoad.json" ,
6+ "scripts" : {
7+ "test" : " echo \" Error: no test specified\" && exit 1"
8+ },
9+ "author" : " Shawn McKay <shawn.j.mckay@gmail.com>" ,
10+ "license" : " ISC" ,
11+ "engines" : {
12+ "node" : " >= 0.10.3"
13+ },
14+ "dependencies" : {
15+ "pytest-coderoad" : " ^0.1.0"
16+ },
17+ "config" : {
18+ "testDir" : " tutorial" ,
19+ "testSuffix" : " .py" ,
20+ "testRunner" : " pytest-coderoad"
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ # load('math.py')
2+
3+ class Test01Class :
4+ def test_add_one (self ):
5+ assert 1 + 1 == 2
Original file line number Diff line number Diff line change 1+ class Test02Class :
2+ def test_subtract_one (self ):
3+ assert 2 - 1 == 1
Original file line number Diff line number Diff line change 1+ class Test03Class :
2+ def test_a_should_be_1 (self ):
3+ assert a == 1
Original file line number Diff line number Diff line change 1+ ### Math
2+ Some basic math.
3+
4+ Addition:
5+ ` 1 + 1 == 2 `
6+
7+ Subtraction:
8+ ` 2 - 1 == 1 `
9+
10+ + This test should pass automatically.
11+ @test ('1/01/01-add')
12+ @action (open('math.py'))
13+ @action (set('# add'))
14+
15+ + This test should also pass automatically
16+ @test ('1/01/02-subtract')
17+ @action (insert('# subtract'))
18+
19+ + Set a variable ` a ` to 1
20+ @test ('1/01/03-value')
21+ @action (insert('# value'))
Original file line number Diff line number Diff line change 1+ # PyTest Demo
2+
3+ A demo for testing Python's PyTest in CodeRoad.
4+
5+ ## Basic
6+
7+ Some basic tests to try out PyTest.
8+
9+ @import ('./tutorial/1/01/math')
You can’t perform that action at this time.
0 commit comments