# Tests pass on github, fail locally

**URL:** <https://discourse.julialang.org/t/tests-pass-on-github-fail-locally/107204>\
**Category:** General Usage\
**Tags:** testing\
**Created:** [December 6, 2023, 9:19am UTC](https://discourse.julialang.org/t/tests-pass-on-github-fail-locally/107204 "2023-12-06T09:19:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [December 6, 2023, 9:19am UTC](https://discourse.julialang.org/t/tests-pass-on-github-fail-locally/107204/1 "2023-12-06T09:19:18Z")

</div>

If I executing:

```julia
using PkgHelpers, Pkg
Pkg.test("PkgHelpers")

```

this fails with:

```julia
freeze: Error During Test at /home/ufechner/.julia/packages/PkgHelpers/UHq7F/test/runtests.jl:28
  Got exception outside of a @test
  SystemError: opening file "/tmp/test-1.toml": Permission denied
  Stacktrace:
    [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
      @ Base ./error.jl:176
    [2] systemerror
      @ Base ./error.jl:175 [inlined]

```

The code that fails is:

```julia
    mydir = tempdir()
    filename = "test-1.toml"
    filename2 = "test-2.toml"
    mytoml = joinpath(mydir, filename)
    cp(filename, mytoml, force=true)

```

Or probably this one:

```julia
  open(project_file, "w") do io

```

Why do I get a permission denied error if I try to write to a file in the tmp directory locally, but not on github?

(Using Ubuntu 22.04)

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [December 6, 2023, 10:29am UTC](https://discourse.julialang.org/t/tests-pass-on-github-fail-locally/107204/2 "2023-12-06T10:29:41Z")

</div>

Ok I could solve the issue by changing the code to:

```julia
mydir = tempdir()
filename = "test-1.toml"
filename2 = "test-2.toml"
mytoml = joinpath(mydir, filename)
cp(filename, mytoml, force=true)
chmod(mytoml, 0o777)

```

The issue was, in a local package all files are read only. I copy a test file to the tmp directory and try to overwrite it there. This only works if I make it writable first.
