feat: align AI configuration and task trunk concurrency with shared schema
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Coverage must measure application packages, not local replacement modules."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
||||
class CoverageBoundaryTests(unittest.TestCase):
|
||||
def test_explicit_project_packages_and_generated_code_exclusion(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
go = root / 'go'
|
||||
go.write_text('''#!/bin/sh
|
||||
set -eu
|
||||
case "$1" in
|
||||
list) printf 'example/app/internal/ai\\nexample/app/gen/agent\\n' ;;
|
||||
test)
|
||||
printf '%s\\n' "$@" > "$COMMANDS"
|
||||
printf 'mode: set\\nexample/app/internal/ai/a.go:1.1,2.2 1 1\\nexample/app/gen/agent/a.go:1.1,2.2 1 0\\n' > "$COVER_PROFILE"
|
||||
;;
|
||||
tool) exit 0 ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
''')
|
||||
go.chmod(0o700)
|
||||
env = dict(os.environ, PATH=str(root) + os.pathsep + os.environ['PATH'],
|
||||
COMMANDS=str(root / 'commands'), COVER_PROFILE=str(root / 'all.out'),
|
||||
COVER_BUSINESS_PROFILE=str(root / 'business.out'))
|
||||
subprocess.run(['sh', str(Path(__file__).with_name('coverage.sh'))], env=env, check=True)
|
||||
args = (root / 'commands').read_text()
|
||||
self.assertIn('-coverpkg=example/app/internal/ai,example/app/gen/agent', args)
|
||||
self.assertNotIn('-coverpkg=./...', args)
|
||||
report = (root / 'business.out').read_text()
|
||||
self.assertIn('/internal/ai/', report)
|
||||
self.assertNotIn('/gen/', report)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user