Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Adapter: Julia #364

Open
Qfl3x opened this issue Feb 15, 2024 · 0 comments
Open

New Adapter: Julia #364

Qfl3x opened this issue Feb 15, 2024 · 0 comments

Comments

@Qfl3x
Copy link

Qfl3x commented Feb 15, 2024

Hello, I'd like to create a Julia Test adapter. I'm kinda new so some help would be nice.

Running tests in Julia is simple for the most part, I'll try to describe it as thoroughly as possible;

We first need to find the root project, -> In Julia: No Project = No tests; Tests are essentially undefined for orphan scripts, tests will always try to find an environment to "containerize" and will fail if not found; While it is possible to test such scripts, it is a pain and is not recommended.

The project has a specific file structure: What matters to us is :

  • the test directory which contains the tests
  • src directory which contains the code
  • Project.toml the defined env for the project
  • Manifest.toml the current resolved env for the project

Tests are ran simply from a test/runtests.jl file, this file is then ran by the Test Runner; Some notes:

  • Tests are usually defined elsewhere and are called in runtests.jl, the calling can be either via a direct function call or through includeing a file.
  • Any tests not called in runtests.jl are not run
  • Tests may be grouped via the macro @testset followed by a block; begin is most common, though for is also very prevalent
  • The smallest unit is @test.

Some people also run their tests in an orphaned way, outside of functions and then just include the file in runtests.jl

The Package/Project tested via: julia --project -e "using Pkg; Pkg.test()"
And yes, --project is usually quite smart and will probably find the project no matter where you are inside the file tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant