-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cd060b
commit e075296
Showing
25 changed files
with
4,716 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,72 @@ | ||
# Fable.Pytest | ||
# Fable.Pyxpecto | ||
|
||
## Ressources | ||
> This repository is heavily inspired by [Fable.Mocha](https://github.com/Zaid-Ajaj/Fable.Mocha/) by the awesome @Zaid-Ajaj. | ||
- [Pytest-Docs](https://docs.pytest.org/en/stable/how-to/capture-warnings.html) | ||
- [Fable.Mocha](https://github.com/Zaid-Ajaj/Fable.Mocha/blob/master/src/Mocha.fs) | ||
- [Fable Features](https://fable.io/Fable.Python/communicate/py-from-fable.html) | ||
- [Fable.Core.Testing](https://github.com/fable-compiler/Fable/blob/main/src/Fable.Core/Fable.Core.Util.fs) | ||
Fable python library for testing. Inspired by the popular Expecto library for F# and adopts the testList, testCase and testCaseAsync primitives for defining tests. | ||
|
||
## Running tests | ||
|
||
Use the following syntax to automatically switch between Expecto, Fable.Mocha and Pyxpecto: | ||
|
||
```fsharp | ||
#if FABLE_COMPILER_PYTHON | ||
open Fable.Pyxpecto | ||
#endif | ||
#if FABLE_COMPILER_JAVASCRIPT | ||
open Fable.Mocha | ||
#endif | ||
#if !FABLE_COMPILER | ||
open Expecto | ||
#endif | ||
``` | ||
|
||
```fsharp | ||
[<EntryPoint>] | ||
let main argv = | ||
#if FABLE_COMPILER_PYTHON | ||
Pyxpecto.runTests all | ||
#endif | ||
#if FABLE_COMPILER_JAVASCRIPT | ||
Mocha.runTests all | ||
#endif | ||
#if !FABLE_COMPILER | ||
Tests.runTestsWithCLIArgs [] [||] all | ||
#endif | ||
``` | ||
|
||
> 👀 Everything in curly braces are placeholders | ||
1. Transpile test project to python `dotnet fable {path/to/tests} --lang py -o {path/to/tests}/py` | ||
2. Run tests `py {path/to/tests}/{EntryFileName.py}` | ||
|
||
## Development | ||
|
||
### How was this set up | ||
### Requirements | ||
|
||
- Python | ||
- check with `py --version` (Tested with `Python 3.11.1`) | ||
- [Dotnet SDK](https://dotnet.microsoft.com/en-us/download) | ||
- check with `dotnet --version` (Tested with `7.0.306`) | ||
- Node | ||
- check with `node --version` (Tested with `v18.16.1`) | ||
- npm | ||
- check with `node --version` (Tested with `9.2.0`) | ||
|
||
### Setup | ||
|
||
Run all commands in root. | ||
|
||
1. `dotnet tool restore` | ||
1. `npm install` | ||
|
||
### Routines | ||
|
||
#### Tests | ||
|
||
`./build.cmd runtests` | ||
|
||
Can be specified to run tests for specific environment. | ||
|
||
1. Check `pip` installed with `pip --version` (Tested with pip 22.0.4 and python 3.9) | ||
2. Install `pipenv` with `py -m pip install pipenv` | ||
3. Test with `py -m pipenv --version` | ||
2. Install pytest globally with `py -m pipenv install pytest`. Created Pipfile | ||
3. Run tests with `py -m pipenv run pytest` | ||
- `./build.cmd runtestsdotnet` | ||
- `./build.cmd runtestsjs` | ||
- `./build.cmd runtestspy` (Currently failing, but commands can be run after another to make it work) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.