File tree Expand file tree Collapse file tree 5 files changed +65
-13
lines changed
Expand file tree Collapse file tree 5 files changed +65
-13
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ initialization :
2+ steps :
3+ - type : commit
4+ empty : true
5+ message : Empty commit
6+ id : start
7+ - type : new-file
8+ filename : .gitignore
9+ contents : |
10+ many/*
11+ why_am_i_hidden.txt
12+ - type : add
13+ files :
14+ - .gitignore
15+ - type : commit
16+ message : Add .gitignore
Original file line number Diff line number Diff line change 1+ initialization :
2+ steps :
3+ - type : commit
4+ empty : true
5+ message : Empty commit
6+ id : start
7+ - type : new-file
8+ filename : .gitignore
9+ contents : |
10+ many/*
11+ !many/file22.txt
12+ ignore_me.txt
13+ this/**/runaway.txt
14+ - type : add
15+ files :
16+ - .gitignore
17+ - type : commit
18+ message : Add .gitignore
Original file line number Diff line number Diff line change 1- from git_autograder import GitAutograderTestLoader
1+ from git_autograder import GitAutograderStatus , GitAutograderTestLoader , assert_output
22
3- from ..verify import verify
3+ from ..verify import (
4+ NOT_IGNORING_IGNORE_ME ,
5+ NOT_IGNORING_RUNAWAY ,
6+ STILL_HIDING ,
7+ STILL_IGNORING_FILE_22 ,
8+ verify ,
9+ )
410
511REPOSITORY_NAME = "ignoring-somethings"
612
713loader = GitAutograderTestLoader (__file__ , REPOSITORY_NAME , verify )
814
915
10- def test ():
11- with loader .load ("specs/base.yml" , "start" ):
12- pass
16+ def test_valid ():
17+ with loader .load ("specs/valid.yml" , "start" ) as output :
18+ assert_output (
19+ output ,
20+ GitAutograderStatus .SUCCESSFUL ,
21+ ["Great work using .gitignore!" ],
22+ )
23+
24+
25+ def test_no_change ():
26+ with loader .load ("specs/no_change.yml" , "start" ) as output :
27+ assert_output (
28+ output ,
29+ GitAutograderStatus .UNSUCCESSFUL ,
30+ [
31+ STILL_IGNORING_FILE_22 ,
32+ STILL_HIDING ,
33+ NOT_IGNORING_IGNORE_ME ,
34+ NOT_IGNORING_RUNAWAY ,
35+ ],
36+ )
Original file line number Diff line number Diff line change 1+ import os
12from typing import List
23
34from git_autograder import GitAutograderOutput , GitAutograderRepo , GitAutograderStatus
@@ -25,13 +26,12 @@ def verify(repo: GitAutograderRepo) -> GitAutograderOutput:
2526 main_branch .latest_commit .checkout ()
2627
2728 # Read the file and parse it
28- with open (".gitignore" , "r" ) as gitignore_file :
29+ with open (os . path . join ( repo . repo_path , ".gitignore" ) , "r" ) as gitignore_file :
2930 lines = [
3031 line .strip () for line in gitignore_file .readlines () if line .strip () != ""
3132 ]
3233
3334 comments : List [str ] = []
34- print (lines )
3535 if "!many/file22.txt" not in lines :
3636 comments .append (STILL_IGNORING_FILE_22 )
3737
You can’t perform that action at this time.
0 commit comments