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

ability to skip compilation before tests #822

Closed
ca11ab1e opened this issue Jun 22, 2022 · 3 comments
Closed

ability to skip compilation before tests #822

ca11ab1e opened this issue Jun 22, 2022 · 3 comments
Labels
category: feature New feature or request

Comments

@ca11ab1e
Copy link

ca11ab1e commented Jun 22, 2022

Overview

I have a setup where both Solidity, and Cairo, contracts live together.
The goal is to be able to test either Solidity contracts, either Cairo contracts, or both at the same time to compare results.

The issue here, is that ape test first recompiles all contracts. That is problematic for 3 reasons:

  1. If I run tests on Solidity contracts, Ape will compile Cairo contracts too (and there may compilation be errors that would block Solidity tests). Not talking about the overall compilation time.
  2. The current behavior does not seem robust (no offense): the recompilation occurs even when files did not change, like every 3 runs, or so. It may be a separate problem, but my proposal could help for such situation.
  3. Compilation checks of all files is done before each test case (meaning a test file with 3 test functions will trigger 3 compilation checks of all contracts). Time, and resource consuming?

Specification

I propose a simple, yet efficient, way of skipping the compilation: APE_NO_COMPILATION environment variable. If set to 1, then no compilation occurs. The name can be debated, of course.
Such change is backward compatible, and does not change the current default behavior.

Dependencies

None.

@antazoey
Copy link
Member

We could also add a flag --skip-compilation to pytest

ape test --skip-compilation or pytest --skip-compilation

@fubuloubu fubuloubu changed the title Add an envar to skip compilation before test feat: add an envar to skip compilation before test Jul 1, 2022
@fubuloubu fubuloubu changed the title feat: add an envar to skip compilation before test Add an envar to skip compilation before test Jul 1, 2022
@antazoey
Copy link
Member

antazoey commented Apr 5, 2023

Item 2 is concerning. I am not sure why that would happen (or even if still does).

--skip-compilation seems okay tho because then you can manage your own compilation via ape compile commands

@antazoey antazoey changed the title Add an envar to skip compilation before test ability to skip compilation before tests Jul 17, 2023
@antazoey
Copy link
Member

this no longer happens. contracts get compiled upon first request now, in a lazy way, regardless of whether you are running tests or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants