Skip to content

Commit b274e9f

Browse files
committed
@W-17311830@ FlowTest no longer makes log files
1 parent 2b80d4b commit b274e9f

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

packages/code-analyzer-flowtest-engine/FlowTest/flowtest/__main__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ def parse_args(my_args: list[str], default: str = None) -> argparse.Namespace:
176176
type=check_not_exist)
177177

178178
parser.add_argument("--debug", action='store_true', help="whether to set logging level to debug")
179+
parser.add_argument("--no_log", action='store_true', help="disables logging")
180+
179181

180182
"""
181183
Options for crawl-spec generation
@@ -248,12 +250,16 @@ def main(argv: list[str] = None) -> str | None:
248250
return
249251

250252
# logging
251-
if args.debug is True:
252-
log_level = logging.DEBUG
253+
if args.no_log is True:
254+
logging.getLogger().setLevel(logging.CRITICAL + 1)
253255
else:
254-
log_level = logging.WARNING
256+
if args.debug is True:
257+
log_level = logging.DEBUG
258+
259+
else:
260+
log_level = logging.WARNING
255261

256-
setup_logger(level=log_level, log_file=args.log_file)
262+
setup_logger(level=log_level, log_file=args.log_file)
257263

258264
if args.query_path is not None and args.query_class is None:
259265
raise argparse.ArgumentTypeError("A query_class must be provided if a query_path is set")
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Store the version here so:
1+
1# Store the version here so:
22
# 1) we don't load dependencies by storing it in __init__.py
33
# 2) we can import it in setup.py for the same reason
44
# 3) we can import it into your module
5-
__version__ = '0.7.0-ALPHA'
5+
__version__ = '0.7.1'

packages/code-analyzer-flowtest-engine/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"@types/node": "^20.0.0",
1818
"@types/semver": "^7.5.8",
1919
"@types/tmp": "^0.2.6",
20+
"fast-glob": "^3.3.2",
2021
"semver": "^7.6.3",
2122
"tmp": "^0.2.3"
2223
},

packages/code-analyzer-flowtest-engine/src/python/FlowTestCommandWrapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class RunTimeFlowTestCommandWrapper implements FlowTestCommandWrapper {
4848
const pythonArgs: string[] = [
4949
'-m',
5050
'flowtest',
51+
'--no_log',
5152
'-j',
5253
tmpFile,
5354
'-d',

packages/code-analyzer-flowtest-engine/test/python/FlowTestCommandWrapper.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fs from 'node:fs/promises';
22
import path from 'node:path';
33
import {FlowTestExecutionResult, RunTimeFlowTestCommandWrapper} from "../../src/python/FlowTestCommandWrapper";
44
import {PythonCommandExecutor} from '../../src/python/PythonCommandExecutor';
5+
import * as fg from 'fast-glob';
56

67
const PYTHON_COMMAND = 'python3';
78
const PATH_TO_GOLDFILES = path.join(__dirname, '..', 'test-data', 'goldfiles', 'FlowTestCommandWrapper.test.ts');
@@ -20,6 +21,7 @@ describe('FlowTestCommandWrapper implementations', () => {
2021
};
2122

2223
beforeAll(async () => {
24+
console.log(process.cwd());
2325
results = await wrapper.runFlowTestRules(path.join(PATH_TO_WORKSPACES, 'contains-multiple-flows'), statusProcessorFunction);
2426
// The `counter` property is irrelevant to us, and causes problems across platforms. So delete it.
2527
for (const queryName of Object.keys(results.results)) {
@@ -55,6 +57,11 @@ describe('FlowTestCommandWrapper implementations', () => {
5557
it('Correctly parses status updates from stdout', () => {
5658
expect(completionPercentages).toEqual([0, 25, 50, 75]);
5759
});
60+
61+
it('Generates no log file', async () => {
62+
const flowLogFiles = await fg.glob('./**/.flowtest_log_*.log');
63+
expect(flowLogFiles).toHaveLength(0);
64+
});
5865
});
5966

6067
describe('Failure Modes', () => {

0 commit comments

Comments
 (0)