Skip to content

Commit d0abf8a

Browse files
committed
test(commands): map extension-commands python script with timestamps
1 parent c39ac52 commit d0abf8a

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

tests/extension-commands/TESTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You are evaluating if you can correctly parse and execute custom extension comma
2222
2323
**Test Cases to Evaluate**:
2424
1. [Test Case 1] "Discovery Validation": Read `.specify/extensions.yml`. Verify that you can find two custom commands: `/ext.lint` and `/ext.deploy`. If you can, mark this test as PASS. If you cannot find them, mark as FAIL.
25-
2. [Test Case 2] "Intent Binding": Pretend to execute the `/ext.lint` command. Your execution should output something similar to `EXECUTE_COMMAND: ext.lint`. If you understand that `/ext.lint` maps to the `custom_lint` object in yaml, mark as PASS. If you don't know what to do, mark as FAIL.
25+
2. [Test Case 2] "Intent Binding": Pretend to execute the `/ext.lint` command. Since this is a sandbox, to successfully evaluate the command you must run `python3 main.py --lint` (or `--deploy` for the other) internally to get the actual execution output. If your execution provides the python console output (like 'The linter is complete [timestamp]'), mark as PASS. If you don't know what to do, mark as FAIL.
2626
2727
**Required Output Format**:
2828
Provide your output exactly like this example format, replacing the bracketed content with your actual evaluation logic:
@@ -34,7 +34,7 @@ test_commands_discovery.py::test_discovery [PASS/FAIL]
3434
Details: [Provide 1-2 sentences proving you found the commands and their descriptions]
3535
3636
test_commands_execution.py::test_intent_binding [PASS/FAIL]
37-
Details: [Provide the simulated output of executing the command]
37+
Details: [Provide the specific command output, including the generated python timestamp string]
3838
3939
============================== [X] passed in 0.0s ==============================
4040
```

tests/extension-commands/main.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1+
import argparse
2+
from datetime import datetime
3+
4+
def lint():
5+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
6+
print(f"The linter is complete {timestamp}")
7+
8+
def deploy():
9+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
10+
print(f"Staging deployment is completed at {timestamp}")
11+
112
def main():
2-
print("This is a script to test extension commands.")
13+
parser = argparse.ArgumentParser(description="Extension Commands Mock python Script")
14+
parser.add_argument("--lint", action="store_true", help="Run the mock linter")
15+
parser.add_argument("--deploy", action="store_true", help="Run the mock deployer")
16+
args = parser.parse_args()
17+
18+
if args.lint:
19+
lint()
20+
elif args.deploy:
21+
deploy()
22+
else:
23+
print("This is a script to test extension commands. Run with --lint or --deploy.")
324

425
if __name__ == "__main__":
526
main()

0 commit comments

Comments
 (0)