File tree 5 files changed +84
-1
lines changed
5 files changed +84
-1
lines changed Original file line number Diff line number Diff line change
1
+ # !/bin/pwsh
2
+ if (Get-Command pip - ErrorAction SilentlyContinue) {
3
+ Write-Host " Installing Python dependencies..."
4
+ pip install - r requirements.txt
5
+ }
6
+ else {
7
+ Write-Host " pip is not installed"
8
+ Write-Host " Installing pip"
9
+ Invoke-WebRequest - Uri https:// bootstrap.pypa.io/ get-pip .py - OutFile get-pip .py
10
+ python get-pip .py
11
+ Write-Host " Installing Python dependencies..."
12
+ pip install - r requirements.txt
13
+ }
14
+
15
+ if (Get-Command pytest - ErrorAction SilentlyContinue) {
16
+ Write-Host " Running tests..."
17
+ pytest -- version
18
+ pytest
19
+ }
20
+ else {
21
+ Write-Host " pytest is not installed"
22
+ Write-Host " installing pytest"
23
+ pip install pytest
24
+ pytest -- version
25
+ pytest
26
+ }
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ if ! [ -x " $( command -v pip) " ]; then
4
+ echo ' Error: pip is not installed.' >&2
5
+ echo ' Installing pip...'
6
+ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
7
+ python get-pip.py
8
+ rm get-pip.py
9
+ echo ' pip installed.'
10
+ fi
11
+
12
+ pip install -r requirements.txt
13
+
14
+ if ! [ -x " $( command -v pytest) " ]; then
15
+ echo ' Error: pytest is not installed.' >&2
16
+ echo ' Installing pytest'
17
+ pip install pytest
18
+ echo ' pytest installed.'
19
+ fi
20
+
21
+ pytest
Original file line number Diff line number Diff line change
1
+ name : Python testing
2
+
3
+ on :
4
+ push :
5
+ branches : ["main"]
6
+ pull_request :
7
+ branches : ["main"]
8
+
9
+ permissions :
10
+ contents : read
11
+
12
+ jobs :
13
+ run_tests_on_ubuntu :
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - uses : actions/checkout@v2
17
+ - name : Run Bash script file
18
+ run : |
19
+ chmod +x ./.github/script/test.sh
20
+ ./.github/script/test.sh
21
+ shell : bash
22
+ run_tests_on_windows :
23
+ runs-on : windows-latest
24
+ steps :
25
+ - uses : actions/checkout@v2
26
+ - name : Run PowerShell script file
27
+ run : |
28
+ .\.github/script/test.ps1
29
+ shell : pwsh
Original file line number Diff line number Diff line change
1
+ from index import say_hello , root
2
+
3
+ def test_root ():
4
+ assert root () == {"message" : "Hello World" }
5
+ def test_say_hello ():
6
+ assert say_hello ("World" ) == {"message" : "Hello World" }
Original file line number Diff line number Diff line change 1
- fastapi == 0.88.0
1
+ fastapi == 0.88.0
2
+ pytest == 7.1.3
You can’t perform that action at this time.
0 commit comments