11"""Tests for placing config dicts into :py:class:`Project` objects."""
2- import os
3-
42from _pytest .compat import LEGACY_PATH
53
64from libvcs import BaseProject , GitProject , MercurialProject , SubversionProject
7- from libvcs .shortcuts import create_project_from_pip_url
5+ from libvcs .shortcuts import create_project
86from vcspull .config import filter_repos
97
108from .fixtures import example as fixtures
@@ -62,9 +60,10 @@ def test_vcs_url_scheme_to_object(tmpdir: LEGACY_PATH):
6260 object based on the pip-style URL scheme.
6361
6462 """
65- git_repo = create_project_from_pip_url (
63+ git_repo = create_project (
6664 ** {
67- "pip_url" : "git+git://git.myproject.org/MyProject.git@da39a3ee5e6b4b" ,
65+ "vcs" : "git" ,
66+ "url" : "git+git://git.myproject.org/MyProject.git@da39a3ee5e6b4b" ,
6867 "dir" : str (tmpdir .join ("myproject1" )),
6968 }
7069 )
@@ -74,19 +73,21 @@ def test_vcs_url_scheme_to_object(tmpdir: LEGACY_PATH):
7473 assert isinstance (git_repo , GitProject )
7574 assert isinstance (git_repo , BaseProject )
7675
77- hg_repo = create_project_from_pip_url (
76+ hg_repo = create_project (
7877 ** {
79- "pip_url" : "hg+https://hg.myproject.org/MyProject#egg=MyProject" ,
78+ "vcs" : "hg" ,
79+ "url" : "hg+https://hg.myproject.org/MyProject#egg=MyProject" ,
8080 "dir" : str (tmpdir .join ("myproject2" )),
8181 }
8282 )
8383
8484 assert isinstance (hg_repo , MercurialProject )
8585 assert isinstance (hg_repo , BaseProject )
8686
87- svn_repo = create_project_from_pip_url (
87+ svn_repo = create_project (
8888 ** {
89- "pip_url" : "svn+svn://svn.myproject.org/svn/MyProject#egg=MyProject" ,
89+ "vcs" : "svn" ,
90+ "url" : "svn+svn://svn.myproject.org/svn/MyProject#egg=MyProject" ,
9091 "dir" : str (tmpdir .join ("myproject3" )),
9192 }
9293 )
@@ -99,20 +100,20 @@ def test_to_repo_objects(tmpdir: LEGACY_PATH):
99100 """:py:obj:`dict` objects into Project objects."""
100101 repo_list = filter_repos (fixtures .config_dict_expanded )
101102 for repo_dict in repo_list :
102- r = create_project_from_pip_url (** repo_dict )
103+ r = create_project (** repo_dict )
103104
104105 assert isinstance (r , BaseProject )
105- assert r .name
106- assert r .name == repo_dict ["name" ]
107- assert r .parent_dir
108- assert r .parent_dir == repo_dict ["parent_dir" ]
106+ assert r .repo_name
107+ assert r .repo_name == repo_dict ["name" ]
108+ assert r .dir . parent
109+ assert r .dir . parent == repo_dict ["parent_dir" ]
109110 assert r .url
110111 assert r .url == repo_dict ["url" ]
111112
112- assert r .path == os . path . join ( r . parent_dir , r . name )
113+ assert r .dir == r . dir / r . repo_name
113114
114115 if "remotes" in repo_dict :
115- assert isinstance (r .remotes , list )
116+ assert isinstance (r .remotes , dict )
116117 for remote_name , remote_dict in r .remotes .items ():
117118 assert isinstance (remote_dict , dict )
118119 assert "fetch_url" in remote_dict
0 commit comments