I am bit confused in working directory of Julia. So if suppose i am working in “test” folder then the working directory of Julia should be “test” i-e if i write pwd() in Julia then it should give me the test folder? Also both “Project.toml” and “Manifest.toml” should be in the same (test) folder?
It would be useful if you can say why you think you are ‘working in’ the folder? To work in a particular folder, I would do one of two things:
- Start Julia from that folder (if you are in Windows, the
/ need to be
> cd /path/to/my/folder
- Run Julia, then set the folder (in this case, you can use
/ in Windows, too):
Two questions: What did you do to set the ‘working’ folder?What do you get when you enter
test a subfolder of a project? If it is, there should be
Manifest.toml in the folder above. There can be
Manifest.toml in the
test folder, but there often isn’t.
Thank you so much for the detailed response. Actually I am working in a main folder called “Project” then there are sub folders of this namely “src” and “test”. In the main project folder i have
Manifest.toml files, in the test folder i have these files too. Now what should i consider my working directory/environment when I am working on a file in “test” folder? should it be the main “Project” folder or the subfolder “test”. Also when i am working in a “test” folder and trying to call a module in “src” folder it give me an error and it says that module is not in the current path? For example see the following code
Now i am running a code in a ‘test’ folder and my working environment in Julia is main “Project” folder and “question1” is a module in ‘src’ folder, when i try to run this code it gives me this error
ArgumentError: Package question1 not found in current path.
import Pkg; Pkg.add("question1") to install the question1 package.
Now I dont know whats wrong here? which path should i be working in, it is bit confusing to me.
I suggest NOT to use the test folder as active folder. Always navigate to the project folder and start julia with
To activate the test environment use the package GitHub - JuliaTesting/TestEnv.jl: Activate your test enviroment, so you can use your test dependencies in the REPL
I agree with @ufechner7 , it’s best to work in the top-level folder, and to work in a local environment using
--project. If the top level is not package
question1, you might need to do what the error message tells you, and add the package to that environment.
I have never used TestEnv.jl, but it looks like it could help you.