2020from  pontos .testing  import  temp_directory , temp_python_module 
2121from  pontos .version .errors  import  ProjectError 
2222from  pontos .version .project  import  Project 
23- from  pontos .version .version  import  Version 
23+ from  pontos .version .schemes  import  PEP440VersioningScheme 
2424
2525
2626class  ProjectTestCase (unittest .TestCase ):
2727    def  test_no_project_found (self ):
2828        with  temp_directory (change_into = True ), self .assertRaisesRegex (
2929            ProjectError , "No project settings file found" 
3030        ):
31-             Project . gather_project ( )
31+             Project ( PEP440VersioningScheme )
3232
3333    def  test_python_project (self ):
34-         current_version  =  Version ("1.2.3" )
35-         new_version  =  Version ("1.2.4" )
34+         current_version  =  PEP440VersioningScheme . parse_version ("1.2.3" )
35+         new_version  =  PEP440VersioningScheme . parse_version ("1.2.4" )
3636
3737        content  =  f"__version__ = '{ current_version }  '" 
3838        with  temp_python_module (
@@ -45,7 +45,7 @@ def test_python_project(self):
4545                encoding = "utf8" ,
4646            )
4747
48-             project  =  Project . gather_project ( )
48+             project  =  Project ( PEP440VersioningScheme )
4949            self .assertEqual (project .get_current_version (), current_version )
5050
5151            update  =  project .update_version (new_version )
@@ -56,16 +56,16 @@ def test_python_project(self):
5656            self .assertEqual (len (update .changed_files ), 2 )
5757
5858    def  test_go_project (self ):
59-         current_version  =  Version ("1.2.3" )
60-         new_version  =  Version ("1.2.4" )
59+         current_version  =  PEP440VersioningScheme . parse_version ("1.2.3" )
60+         new_version  =  PEP440VersioningScheme . parse_version ("1.2.4" )
6161
6262        with  temp_directory (change_into = True ) as  temp_dir :
6363            project_file  =  temp_dir  /  "go.mod" 
6464            project_file .touch ()
6565            version_file  =  temp_dir  /  "version.go" 
6666            version_file .write_text (f'var version = "{ current_version }  "' )
6767
68-             project  =  Project . gather_project ( )
68+             project  =  Project ( PEP440VersioningScheme )
6969            self .assertEqual (project .get_current_version (), current_version )
7070
7171            update  =  project .update_version (new_version )
@@ -76,8 +76,8 @@ def test_go_project(self):
7676            self .assertEqual (len (update .changed_files ), 1 )
7777
7878    def  test_javascript_project (self ):
79-         current_version  =  Version ("1.2.3" )
80-         new_version  =  Version ("1.2.4" )
79+         current_version  =  PEP440VersioningScheme . parse_version ("1.2.3" )
80+         new_version  =  PEP440VersioningScheme . parse_version ("1.2.4" )
8181
8282        with  temp_directory (change_into = True ) as  temp_dir :
8383            version_file  =  temp_dir  /  "package.json" 
@@ -86,7 +86,7 @@ def test_javascript_project(self):
8686                encoding = "utf8" ,
8787            )
8888
89-             project  =  Project . gather_project ( )
89+             project  =  Project ( PEP440VersioningScheme )
9090            self .assertEqual (project .get_current_version (), current_version )
9191
9292            update  =  project .update_version (new_version )
@@ -97,14 +97,14 @@ def test_javascript_project(self):
9797            self .assertEqual (len (update .changed_files ), 1 )
9898
9999    def  test_cmake_project_version (self ):
100-         current_version  =  Version ("1.2.3" )
101-         new_version  =  Version ("1.2.4" )
100+         current_version  =  PEP440VersioningScheme . parse_version ("1.2.3" )
101+         new_version  =  PEP440VersioningScheme . parse_version ("1.2.4" )
102102
103103        with  temp_directory (change_into = True ) as  temp_dir :
104104            version_file  =  temp_dir  /  "CMakeLists.txt" 
105105            version_file .write_text ("project(VERSION 1.2.3)" , encoding = "utf8" )
106106
107-             project  =  Project . gather_project ( )
107+             project  =  Project ( PEP440VersioningScheme )
108108            self .assertEqual (project .get_current_version (), current_version )
109109
110110            update  =  project .update_version (new_version )
@@ -115,8 +115,8 @@ def test_cmake_project_version(self):
115115            self .assertEqual (len (update .changed_files ), 1 )
116116
117117    def  test_all (self ):
118-         current_version  =  Version ("1.2.3" )
119-         new_version  =  Version ("1.2.4" )
118+         current_version  =  PEP440VersioningScheme . parse_version ("1.2.3" )
119+         new_version  =  PEP440VersioningScheme . parse_version ("1.2.4" )
120120
121121        content  =  f"__version__ = '{ current_version }  '" 
122122        with  temp_python_module (
@@ -146,7 +146,7 @@ def test_all(self):
146146                "project(VERSION 1.2.3)" , encoding = "utf8" 
147147            )
148148
149-             project  =  Project . gather_project ( )
149+             project  =  Project ( PEP440VersioningScheme )
150150            self .assertEqual (project .get_current_version (), current_version )
151151
152152            update  =  project .update_version (new_version )
0 commit comments