Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Commit

Permalink
chore: move conftest to root directory (#1473)
Browse files Browse the repository at this point in the history
pytest_plugins cannot be declared in non-top-level conftest. It was not
possible to launch a test with -k

<!--- Please provide a general summary of your changes in the title
above -->

<!-- Give an estimate of the time you spent on this PR in terms of work
days.
Did you spend 0.5 days on this PR or rather 2 days?  -->

Time spent on this PR:

## Pull request type

<!-- Please try to limit your pull request to one type,
submit multiple pull requests if needed. -->

Please check the type of change your PR introduces:

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [x] Other (please describe):

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying,
or link to a relevant issue. -->

Resolves #<Issue number>

## What is the new behavior?

<!-- Reviewable:start -->
- - -
This change is [<img src="https://reviewable.io/review_button.svg"
height="34" align="absmiddle"
alt="Reviewable"/>](https://reviewable.io/reviews/kkrt-labs/kakarot/1473)
<!-- Reviewable:end -->
  • Loading branch information
obatirou authored Oct 8, 2024
1 parent 982593d commit 137684e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 34 deletions.
40 changes: 35 additions & 5 deletions cairo_zero/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
# ruff: noqa: F403
import logging
import os

# Import everything from the root conftest.py
from tests.conftest import *
from tests.fixtures import *
from tests.utils import *
from dotenv import load_dotenv
from hypothesis import Phase, Verbosity, settings

load_dotenv()
logging.getLogger("asyncio").setLevel(logging.ERROR)
logger = logging.getLogger()

settings.register_profile(
"nightly",
deadline=None,
max_examples=1500,
phases=[Phase.explicit, Phase.reuse, Phase.generate, Phase.target],
)
settings.register_profile(
"ci",
deadline=None,
max_examples=100,
phases=[Phase.explicit, Phase.reuse, Phase.generate, Phase.target],
)
settings.register_profile(
"dev",
deadline=None,
max_examples=10,
phases=[Phase.explicit, Phase.reuse, Phase.generate, Phase.target],
)
settings.register_profile(
"debug",
max_examples=10,
verbosity=Verbosity.verbose,
phases=[Phase.explicit, Phase.reuse, Phase.generate, Phase.target],
)
settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "default"))
logger.info(f"Using Hypothesis profile: {os.getenv('HYPOTHESIS_PROFILE', 'default')}")
29 changes: 0 additions & 29 deletions tests/conftest.py → conftest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import asyncio
import logging
import os

import pytest
from dotenv import load_dotenv
from hypothesis import Phase, Verbosity, settings
from starkware.cairo.lang.instances import LAYOUTS

load_dotenv()
Expand Down Expand Up @@ -58,30 +56,3 @@ def seed(request):


pytest_plugins = ["tests.fixtures.starknet"]

settings.register_profile(
"nightly",
deadline=None,
max_examples=1500,
phases=[Phase.explicit, Phase.reuse, Phase.generate, Phase.target],
)
settings.register_profile(
"ci",
deadline=None,
max_examples=100,
phases=[Phase.explicit, Phase.reuse, Phase.generate, Phase.target],
)
settings.register_profile(
"dev",
deadline=None,
max_examples=10,
phases=[Phase.explicit, Phase.reuse, Phase.generate, Phase.target],
)
settings.register_profile(
"debug",
max_examples=10,
verbosity=Verbosity.verbose,
phases=[Phase.explicit, Phase.reuse, Phase.generate, Phase.target],
)
settings.load_profile(os.getenv("HYPOTHESIS_PROFILE", "default"))
logger.info(f"Using Hypothesis profile: {os.getenv('HYPOTHESIS_PROFILE', 'default')}")

0 comments on commit 137684e

Please sign in to comment.