File tree Expand file tree Collapse file tree 4 files changed +58
-2
lines changed Expand file tree Collapse file tree 4 files changed +58
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,10 @@ name: Pull Request Merge Precondition
3
3
on :
4
4
pull_request :
5
5
6
+ permissions :
7
+ contents : read
8
+ pull-requests : write
9
+
6
10
jobs :
7
11
build :
8
12
runs-on : ubuntu-latest
11
15
python-version : [3.8]
12
16
13
17
steps :
14
- - uses : actions/checkout@v2
18
+ - uses : actions/checkout@v3
19
+ with :
20
+ persist-credentials : true # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
21
+ fetch-depth : 0 # otherwise, you will failed to push refs to dest repo
22
+
15
23
- uses : psf/black@stable
16
24
with :
17
25
options : " --check --verbose --exclude migrations"
20
28
with :
21
29
configuration : " --check-only --diff --profile black"
22
30
requirementsFiles : " requirements.txt"
31
+
32
+ - name : install dependencies
33
+ run : |
34
+ python -m pip install --upgrade pip
35
+ pip install -r requirements.txt
36
+ pip install -r requirements-dev.txt
37
+ pip install pytest-cov
38
+
39
+ - name : run pytest
40
+ run : |
41
+ pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=pyconkr ./ | tee pytest-coverage.txt
42
+
43
+ # - name: Pytest coverage comment
44
+ # uses: MishaKav/pytest-coverage-comment@main
45
+ # with:
46
+ # pytest-coverage-path: ./pytest-coverage.txt
47
+ # junitxml-path: ./pytest.xml
Original file line number Diff line number Diff line change 10
10
* mac
11
11
* brew install mysql-client
12
12
* pip install -r requirements.txt
13
+
14
+ ## how to run localtesting ( sqlite3 based )
15
+ ```
16
+ # to setup pytest and requirements
17
+ pip install -r requirements-dev.txt
18
+ # run test
19
+ pytest
20
+ ```
Original file line number Diff line number Diff line change 1
- from django .test import TestCase
1
+ import pytest
2
+ from django .contrib .auth import get_user_model
3
+
4
+ from sponsor .models import SponsorLevel
5
+
6
+ pytestmark = pytest .mark .django_db
7
+
8
+ UserModel = get_user_model ()
9
+
10
+
11
+ @pytest .mark .django_db
12
+ class TestSponsorLevelModel :
13
+ pytestmark = pytest .mark .django_db
14
+
15
+ def test_sponsor_level_creation_success (self ):
16
+ assert SponsorLevel .objects .count () == 0
17
+ SponsorLevel .objects .create (
18
+ name = "test" ,
19
+ desc = "test desc" ,
20
+ visible = True ,
21
+ limit = 1 ,
22
+ )
23
+ assert SponsorLevel .objects .count () != 0
24
+
2
25
3
26
# Create your tests here.
You can’t perform that action at this time.
0 commit comments