Skip to content

Commit

Permalink
synchronize filecheck and pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
webmiche committed Dec 7, 2022
1 parent e3a0ea1 commit 8a3e776
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ omit =
xdsl/_version.py
concurrency = multiprocessing
parallel = True
source =
xdsl/


[report]
# Regexes for lines to exclude from consideration
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,18 @@ jobs:
pip install --upgrade pip
- name: Install the package locally
run: pip install -e .[extras]
- name: Test with pytest and check code coverage
- name: Test with pytest and generate code coverage
run: |
pytest --cov --cov-config=.coveragerc --cov-report=xml tests/
coverage run -m pytest tests/
- name: Execute lit tests
run: |
export PYTHONPATH=$(pwd)
lit -v tests/filecheck/
- name: Combine coverage data
run: |
coverage combine
coverage report
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
12 changes: 0 additions & 12 deletions xdsl/tools/xdsl-opt
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,16 @@ class OptMain(xDSLOptMain):
while (os.getcwd().split('/')[-1] != 'xdsl'):
os.chdir('../')

data_file = ".coverage"
cov = coverage.Coverage(check_preimported=True,
data_file=data_file,
data_suffix='',
config_file='.coveragerc',
source_pkgs=['xdsl'],
branch=True,
auto_data=True)
if not os.path.exists(data_file):

# Sometimes when the `.coverage` file is not available, some tests
# fail with weird behavior. This ensures that the file is there.
cov.start()
cov.stop()
cov.save()

cov.start()

super().run()

cov.stop()
cov.xml_report(outfile="./coverage.xml")


def __main__():
Expand Down

0 comments on commit 8a3e776

Please sign in to comment.