66
77import pytest
88
9- from pip ._internal .utils .misc import hide_url
109from pip ._internal .vcs .bazaar import Bazaar
1110from pip ._internal .vcs .versioncontrol import RemoteNotFoundError
12- from tests .lib import (
13- _test_path_to_file_url ,
14- _vcs_add ,
15- create_file ,
16- is_bzr_installed ,
17- need_bzr ,
18- )
11+ from tests .lib import is_bzr_installed , need_bzr
1912
2013
2114@pytest .mark .skipif (
@@ -26,48 +19,6 @@ def test_ensure_bzr_available():
2619 assert is_bzr_installed ()
2720
2821
29- @need_bzr
30- def test_export (script , tmpdir ):
31- """Test that a Bazaar branch can be exported."""
32- source_dir = tmpdir / 'test-source'
33- source_dir .mkdir ()
34-
35- create_file (source_dir / 'test_file' , 'something' )
36-
37- _vcs_add (script , str (source_dir ), vcs = 'bazaar' )
38-
39- export_dir = str (tmpdir / 'export' )
40- url = hide_url ('bzr+' + _test_path_to_file_url (source_dir ))
41- Bazaar ().export (export_dir , url = url )
42-
43- assert os .listdir (export_dir ) == ['test_file' ]
44-
45-
46- @need_bzr
47- def test_export_rev (script , tmpdir ):
48- """Test that a Bazaar branch can be exported, specifying a rev."""
49- source_dir = tmpdir / 'test-source'
50- source_dir .mkdir ()
51-
52- # Create a single file that is changed by two revisions.
53- create_file (source_dir / 'test_file' , 'something initial' )
54- _vcs_add (script , str (source_dir ), vcs = 'bazaar' )
55-
56- create_file (source_dir / 'test_file' , 'something new' )
57- script .run (
58- 'bzr' , 'commit' , '-q' ,
59- '--author' , 'pip <distutils-sig@python.org>' ,
60- '-m' , 'change test file' , cwd = source_dir ,
61- )
62-
63- export_dir = tmpdir / 'export'
64- url = hide_url ('bzr+' + _test_path_to_file_url (source_dir ) + '@1' )
65- Bazaar ().export (str (export_dir ), url = url )
66-
67- with open (export_dir / 'test_file' ) as f :
68- assert f .read () == 'something initial'
69-
70-
7122@need_bzr
7223def test_get_remote_url__no_remote (script , tmpdir ):
7324 repo_dir = tmpdir / 'temp-repo'
0 commit comments