# Run test on fresh github downloaded package

**URL:** <https://discourse.julialang.org/t/run-test-on-fresh-github-downloaded-package/17652>\
**Category:** New to Julia\
**Created:** [November 17, 2018, 6:50pm UTC](https://discourse.julialang.org/t/run-test-on-fresh-github-downloaded-package/17652 "2018-11-17T18:50:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![patefacio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patefacio/32/6095_2.png) [@patefacio](https://discourse.julialang.org/u/patefacio)\
**Post date:** [November 17, 2018, 6:50pm UTC](https://discourse.julialang.org/t/run-test-on-fresh-github-downloaded-package/17652/1 "2018-11-17T18:50:10Z")

</div>

I am trying to learn how to run tests. I was able to create `MyProject`, activate it, and run tests per the documentation. Now I would like to I download and test a package, like the DataFrames package.

First I `git clone https://github.com/JuliaData/DataFrames.jl`.

Then I go to that directory and run julia repl. I enter package mode, ‘]’ and then `activate .`. My attempts to `test DataFrames`, `test DataFrames.jl`, `test .` all fail. Am I missing a build step?

I was able to `add /Users/dbdavidson/dev/open_source/DataFrames.jl/` to an existing package, then `import DataFrames`, then `test DataFrames` but this requires creation of an additional package so I think there is likely an easier/better way.

What is the easiest way to download and then test github code package?

Can it all be done from the command line, with a one-liner, without entering julia repl?

---

<div class="post-metadata">

**Author:** ![tanhevg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tanhevg/32/12025_2.png) [@tanhevg](https://discourse.julialang.org/u/tanhevg)\
**Post date:** [November 17, 2018, 7:43pm UTC](https://discourse.julialang.org/t/run-test-on-fresh-github-downloaded-package/17652/2 "2018-11-17T19:43:10Z")

</div>

In repl, after entering package mode via `]`:

```julia
pkg> add DataFrames # check out and installs the latest version of Dataframes
# or
pkg> dev DataFrames # if you want to modify the code of DataFrames

pkg> test DataFrames # this builds and runs the tests

```

More on this here: [Pkg · The Julia Language](https://docs.julialang.org/en/v1/stdlib/Pkg/)

---

<div class="post-metadata">

**Author:** ![patefacio](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/patefacio/32/6095_2.png) [@patefacio](https://discourse.julialang.org/u/patefacio)\
**Post date:** [November 17, 2018, 8:41pm UTC](https://discourse.julialang.org/t/run-test-on-fresh-github-downloaded-package/17652/3 "2018-11-17T20:41:45Z")

</div>

Ahh, so `add .` from within DataFrames.jl directory is not same as `add DataFrames` I guess. That worked, thanks.

Can this be scripted somehow? What I’m really wondering is how to write a script that uses code from the same module. The closest I’ve found is the suggestion to put scripts in the `test` folder. So if there is `test/my_script.jl` and there is library code in `src/my_code.jl` that it needs, how can I run my\_script.jl with julia executable without entering the repl such that it finds the code? Ideally, there are any github examples of such a package would be great.

---

<div class="post-metadata">

**Author:** ![tanhevg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tanhevg/32/12025_2.png) [@tanhevg](https://discourse.julialang.org/u/tanhevg)\
**Post date:** [November 18, 2018, 12:45am UTC](https://discourse.julialang.org/t/run-test-on-fresh-github-downloaded-package/17652/4 "2018-11-18T00:45:48Z")

</div>

> [@patefacio](#):
>
> Can this be scripted somehow?

You can call functions of `Pkg` module, like `Pkg.add()` or `Pkg.activate()`. It is quite well documented [here](https://docs.julialang.org/en/v1/stdlib/Pkg/) and [here](https://docs.julialang.org/en/v1/stdlib/Pkg/#References-1)

> [@patefacio](#):
>
> So if there is `test/my_script.jl` and there is library code in `src/my_code.jl` that it needs, how can I run my\_script.jl with julia executable without entering the repl such that it finds the code?

If both `src/my_code.jl` and `test/my_script.jl` belong to the same package, and that package has the appropriate environment specification (`Project.toml` and `Manifest.toml`), then you could simply put `Pkg.activate("..")` at the top of `test/my_script.jl`. Or, if you don’t want to pollute the test code, you could just go ` pkg> dev path/to/my_my_module` once.

In either case, at the top of `test/my_script.jl` you need to add the `using my_module` line. Again, it it all there in the docs.
