1- // vtest retry: 3
21import os
32import time
43import rand
@@ -13,13 +12,14 @@ fn testsuite_begin() {
1312 eprintln ('> skipping ${@FILE }, when `-d network` is missing' )
1413 exit (0 )
1514 }
16- unbuffer_stdout ( )
17- os. setenv ( 'VMODULES' , test_path, true )
18- os.setenv ( 'VPM_DEBUG' , '' , true )
19- os.setenv ( 'VPM_NO_INCREMENT' , '1' , true )
15+ dump (test_path )
16+ test_utils. set_test_env ( test_path)
17+ os.mkdir_all (test_path) or {}
18+ os.chdir (test_path) !
2019}
2120
2221fn testsuite_end () {
22+ dump (os.system ('find ${test_path }' ))
2323 os.rmdir_all (test_path) or {}
2424}
2525
@@ -33,7 +33,6 @@ fn get_mod_name(path string) string {
3333
3434// Case: running `v install` without specifying modules in a V project directory.
3535fn test_install_dependencies_in_module_dir () {
36- os.mkdir_all (test_path) or {}
3736 mod := 'my_module'
3837 mod_path := os.join_path (test_path, mod)
3938 os.mkdir (mod_path)!
@@ -56,9 +55,9 @@ fn test_install_dependencies_in_module_dir() {
5655 // Run `v install`
5756 mut res := cmd_ok (@LOCATION, '${v } install --once' )
5857 assert res.output.contains ('Detected v.mod file inside the project directory. Using it...' ), res.output
59- assert res.output. contains ( 'Installing ` markdown`' ), res.output
60- assert res.output. contains ( 'Installing ` pcre`' ), res.output
61- assert res.output. contains ( 'Installing ` vtray`' ), res.output
58+ expect_installing (@LOCATION, res.output, ' markdown' )
59+ expect_installing (@LOCATION, res.output, ' pcre' )
60+ expect_installing (@LOCATION, res.output, ' vtray' )
6261
6362 assert get_mod_name (os.join_path (test_path, 'markdown' , 'v.mod' )) == 'markdown'
6463 assert get_mod_name (os.join_path (test_path, 'pcre' , 'v.mod' )) == 'pcre'
@@ -70,8 +69,8 @@ fn test_install_dependencies_in_module_dir() {
7069fn test_resolve_external_dependencies_during_module_install () {
7170 res := cmd_ok (@LOCATION, '${v } install -v https://github.com/ttytm/emoji-mart-desktop' )
7271 assert res.output.contains ('Found 2 dependencies' ), res.output
73- assert res.output. contains ( 'Installing ` webview`' ), res.output
74- assert res.output. contains ( 'Installing ` miniaudio`' ), res.output
72+ expect_installing (@LOCATION, res.output, ' webview' )
73+ expect_installing (@LOCATION, res.output, ' miniaudio' )
7574 // The external dependencies should have been installed to `<vmodules_dir>/<dependency_name>`
7675 assert get_mod_name (os.join_path (test_path, 'webview' , 'v.mod' )) == 'webview'
7776 assert get_mod_name (os.join_path (test_path, 'miniaudio' , 'v.mod' )) == 'miniaudio'
@@ -91,3 +90,8 @@ fn test_install_with_recursive_dependencies() {
9190 cmd_ok (@LOCATION, '${v } remove a b c' )
9291 cmd_ok (@LOCATION, '${v } install https://gitlab.com/tobealive/a.git' )
9392}
93+
94+ fn expect_installing (location string , output string , what string ) {
95+ eprintln ('>>> location: ${location }' )
96+ assert output.contains ('Installing `${what }`' ) || output.contains ('Scanning `${what }`' ), output
97+ }
0 commit comments