Skip to content

Commit

Permalink
Generate .coverage file within the specs
Browse files Browse the repository at this point in the history
  • Loading branch information
littleforest committed Apr 1, 2024
1 parent d89aace commit 5297123
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install dependencies
run: shards install
- name: Install coverage.py
run: "pip install --upgrade pip && pip install coverage"
run: "pip install --upgrade pip && pip install coverage && pip install pytest"
- name: Run tests
run: crystal spec --verbose --order random --error-on-warnings

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
/docs/
/insecure_private_keys
/lib/
.coverage
coverage.xml
15 changes: 15 additions & 0 deletions spec/coverage_reporter/parsers/coveragepy_parser_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ require "../../spec_helper"
Spectator.describe CoverageReporter::CoveragepyParser do
subject { described_class.new(nil) }

before_each do
error = IO::Memory.new
output = IO::Memory.new
process_status = Process.run(
command: "coverage run -m pytest",
chdir: "spec/fixtures/python",
shell: true,
error: error,
output: output
)
unless process_status.success?
raise "Failed: #{error}\n#{output}"
end
end

describe "#matches?" do
it "matches only SQLite3 db file" do

Check failure on line 22 in spec/coverage_reporter/parsers/coveragepy_parser_spec.cr

View workflow job for this annotation

GitHub Actions / coverage

???
expect(subject.matches?("spec/fixtures/python/.coverage")).to eq true
Expand Down
1 change: 0 additions & 1 deletion spec/coverage_reporter/reporter_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Spectator.describe CoverageReporter::Reporter do
after_each { ENV.delete("COVERALLS_ENDPOINT") }

it "doesn't raise an error" do
subject.report
expect { subject.report }.not_to raise_error
end
end
Expand Down
Binary file removed spec/fixtures/python/.coverage
Binary file not shown.

0 comments on commit 5297123

Please sign in to comment.