@@ -483,142 +483,60 @@ Show brick depencencies for a specific project.
483
483
` --brick `
484
484
A detailed view for a single brick and the dependent bricks: used by, and uses.
485
485
486
- ## Testing
487
- Example, how to run __ pytest __ for changed bricks only .
486
+ ## Test
487
+ Polylith doesn't have its own test runner. Use your favorite testing tool, such as ` pytest ` .
488
488
489
- #### Poetry
490
- ``` shell
491
- # store the comma-separated list of bricks in a bash variable
492
- changes=" $( poetry poly diff --bricks --short) "
493
-
494
- # transform it into a pytest query,
495
- # i.e. from "hello,world,something" to "hello or world or something"
496
- query=" ${changes// ,/ or } "
497
- ```
489
+ ### Running tests
490
+ See the [ testing] ( testing.md ) section for examples on how to run __ pytest__ for changed bricks only.
498
491
499
- Run the test, filtered by keyword expression
500
-
501
- ``` shell
502
- poetry run pytest -k <<< echo " $query "
503
- ```
492
+ ### Test diff
493
+ With the ` poly test ` command, You can identify the bricks and projects that are _ affected_ by changes in tests.
494
+ The ` poly test ` command is used with a sub-command: __ poly test diff__ .
495
+ It will show you any affected bricks or projects a test is modified.
504
496
505
- or run the test, filtered by pytest markers
497
+ Tests are expected to live in a test folder at the Workspace root when using the recommended __ loose__ theme.
498
+ For users of the __ tdd__ theme, the tests are expected to be found in the brick test folder.
506
499
500
+ #### Poetry
507
501
``` shell
508
- poetry run pytest -m <<< echo " $query "
502
+ poetry poly test diff
509
503
```
510
504
511
505
#### Hatch
512
506
``` shell
513
- # store the comma-separated list of bricks in a bash variable
514
- changes=" $( hatch run poly diff --bricks --short) "
515
-
516
- # transform it into a pytest query,
517
- # i.e. from "hello,world,something" to "hello or world or something"
518
- query=" ${changes// ,/ or } "
519
- ```
520
-
521
- Run the test, filtered by keyword expression
522
-
523
- ``` shell
524
- hatch run pytest -k <<< echo " $query "
525
- ```
526
-
527
- or run the test, filtered by pytest markers
528
-
529
- ``` shell
530
- hatch run pytest -m <<< echo " $query "
507
+ hatch run poly test diff
531
508
```
532
509
533
510
#### PDM
534
511
``` shell
535
- # store the comma-separated list of bricks in a bash variable
536
- changes=" $( pdm run poly diff --bricks --short) "
537
-
538
- # transform it into a pytest query,
539
- # i.e. from "hello,world,something" to "hello or world or something"
540
- query=" ${changes// ,/ or } "
541
- ```
542
-
543
- Run the test, filtered by keyword expression
544
-
545
- ``` shell
546
- pdm run pytest -k <<< echo " $query "
547
- ```
548
-
549
- or run the test, filtered by pytest markers
550
-
551
- ``` shell
552
- pdm run pytest -m <<< echo " $query "
512
+ pdm run poly test diff
553
513
```
554
514
555
515
#### Rye
556
516
``` shell
557
- # store the comma-separated list of bricks in a bash variable
558
- changes=" $( rye run poly diff --bricks --short) "
559
-
560
- # transform it into a pytest query,
561
- # i.e. from "hello,world,something" to "hello or world or something"
562
- query=" ${changes// ,/ or } "
563
- ```
564
-
565
- Run the test, filtered by keyword expression
566
-
567
- ``` shell
568
- rye run pytest -k <<< echo " $query "
569
- ```
570
-
571
- or run the test, filtered by pytest markers
572
-
573
- ``` shell
574
- rye run pytest -m <<< echo " $query "
517
+ rye run poly test diff
575
518
```
576
519
577
520
#### uv
578
521
``` shell
579
- # store the comma-separated list of bricks in a bash variable
580
- changes=" $( uv run poly diff --bricks --short) "
581
-
582
- # transform it into a pytest query,
583
- # i.e. from "hello,world,something" to "hello or world or something"
584
- query=" ${changes// ,/ or } "
585
- ```
586
-
587
- Run the test, filtered by keyword expression
588
-
589
- ``` shell
590
- uv run pytest -k <<< echo " $query "
591
- ```
592
-
593
- or run the test, filtered by pytest markers
594
-
595
- ``` shell
596
- uv run pytest -m <<< echo " $query "
522
+ uv run poly test diff
597
523
```
598
524
599
525
#### Maturin
600
526
``` shell
601
527
# if not already activated a virtual environment
602
528
source .venv/bin/activate
603
- ```
604
529
605
- ``` shell
606
- # store the comma-separated list of bricks in a bash variable
607
- changes=" $( poly diff --bricks --short) "
608
-
609
- # transform it into a pytest query,
610
- # i.e. from "hello,world,something" to "hello or world or something"
611
- query=" ${changes// ,/ or } "
530
+ poly test diff
612
531
```
613
532
614
- Run the test, filtered by keyword expression
533
+ ### Options
534
+ ` --short ` Useful for determining what projects has been affected by the changes in CI.
615
535
616
- ``` shell
617
- pytest -k <<< echo " $query "
618
- ```
536
+ ` --bricks ` Useful for displaying affected bricks only. It will print a comma-separated list of bricks when using it with the ` --short ` option.
619
537
620
- or run the test, filtered by pytest markers
538
+ ` --projects ` Useful for displaying affected projects only. It will print a comma-separated list of projects when using it with the ` --short ` option.
621
539
622
- ``` shell
623
- pytest -m <<< echo " $query "
624
- ```
540
+ ` --since ` Useful for displaying changes since a ` stable ` or ` release ` tag.
541
+ The tag patterns are defined in the Workspace [ configuration ] ( configuration.md ) .
542
+ This option also support using a specific commit hash.
0 commit comments