Skip to content

Commit

Permalink
Merge branch 'main' into feature/code-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Prescod committed Sep 23, 2022
2 parents 2ed8379 + 275d635 commit 7b03b3e
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 49 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env:
COVERALLS_PARALLEL: true
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
SF_MKDOCS_BUILD_LOCALES: "False"
BASE_REF: main

jobs:
test:
Expand Down Expand Up @@ -43,6 +44,9 @@ jobs:
runs-on: sfdc-ubuntu-latest
steps:
- uses: "actions/checkout@v2"
- run: |
git fetch --no-tags origin $BASE_REF:$BASE_REF
- uses: "actions/setup-python@v1"
with:
python-version: "3.9"
Expand All @@ -55,7 +59,17 @@ jobs:
python -m pip install cumulusci
- name: Run Tests
run: python -m pytest
run: |
python -m coverage run -m pytest
- name: Check Coverage
run: |
coverage xml
coverage report
echo $BASE_REF
git diff HEAD..$BASE_REF
diff-cover coverage.xml --fail-under 100 --compare-branch=$BASE_REF --diff-range-notation=.. --show-uncovered --markdown-report coverage.md
cat coverage.md >> $GITHUB_STEP_SUMMARY
faker_docs:
name: Faker Docs
Expand Down
7 changes: 4 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Snowfakery can write its output to `stdout`, or any database accessible to SQLAl

### Installation for Salesforce Users

If you intend to use Snowfakery with Salesforce, we recommend installing CumulusCI, which includes Snowfakery in the installation. To install CumulusCI, follow the steps in the [Get Started](https://cumulusci.readthedocs.io/en/latest/get_started.html) section of the CumulusCI documentation. (Don't forget to install [Python](https://www.python.org/downloads/), too!)
If you intend to use Snowfakery with Salesforce, we recommend installing CumulusCI, which includes Snowfakery in the installation. To install CumulusCI, follow the steps in the [Get Started](https://cumulusci.readthedocs.io/en/latest/get-started.html) section of the CumulusCI documentation. (Don't forget to install [Python](https://www.python.org/downloads/), too!)

After installation, use the `snowfakery` task command to invoke Snowfakery.

Expand Down Expand Up @@ -598,6 +598,8 @@ To create a reference, `random_reference` looks for a row created in the current

If `random_reference` finds no matches in the current iteration, it looks in previous iterations. This can happen, for example, when you try to create a reference to an object created with the `just_once` flag. Snowfakery cannot currently generate a `random_reference` to a row that will be created in a future iteration of a recipe.

Performance tip: Tables and nicknames that are referred to by `random_reference` are indexed, which makes them slightly slower to generate than normal. This should seldom be a problem in practice, but if you experience performance problems you could switch to a normal `reference` to see if that improves things.

#### Unique random references

`random_reference` has a `unique` parameter which ensures that each target row is used only once.
Expand All @@ -612,7 +614,7 @@ If `random_reference` finds no matches in the current iteration, it looks in pre
count: 10
fields:
ownedBy:
random_reference:
random_reference:
to: Owner
unique: True
```
Expand Down Expand Up @@ -677,7 +679,6 @@ CampaignMember(id=14, ContactId=Contact(3), CampaignId=Campaign(5))
CampaignMember(id=15, ContactId=Contact(3), CampaignId=Campaign(2))
```

Performance tip: Tables and nicknames that are referred to by `random_reference` are indexed, which makes them slightly slower to generate than normal. This should seldom be a problem in practice, but if you experience performance problems you could switch to a normal reference to see if that improves things.
### `fake`

The `fake` function generates fake data. This function is defined further in the [Fake Data Tutorial](fakedata.md)
Expand Down
1 change: 1 addition & 0 deletions requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
black
coverage
coveralls
diff-cover
mkdocs<1.3.0 # need to change Snowfakery monkey-patching before upgrade
mkdocs-exclude-search
pre-commit
Expand Down
80 changes: 45 additions & 35 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
#
# pip-compile --allow-unsafe requirements/dev.in
#
attrs==21.4.0
attrs==22.1.0
# via
# jsonschema
# pytest
black==22.3.0
black==22.8.0
# via -r requirements/dev.in
certifi==2021.10.8
certifi==2022.9.14
# via
# -r requirements/prod.txt
# requests
cfgv==3.3.1
# via pre-commit
charset-normalizer==2.0.12
chardet==5.0.0
# via diff-cover
charset-normalizer==2.1.1
# via
# -r requirements/prod.txt
# requests
Expand All @@ -25,57 +27,60 @@ click==8.1.3
# -r requirements/prod.txt
# black
# mkdocs
coverage[toml]==6.3.2
coverage[toml]==6.4.4
# via
# -r requirements/dev.in
# coveralls
# pytest-cov
coveralls==3.3.1
# via -r requirements/dev.in
distlib==0.3.4
diff-cover==6.5.1
# via -r requirements/dev.in
distlib==0.3.6
# via virtualenv
docopt==0.6.2
# via coveralls
faker==12.3.3
faker==14.2.0
# via
# -r requirements/prod.txt
# faker-microservice
faker-microservice==2.0.0
# via -r requirements/dev.in
filelock==3.6.0
filelock==3.8.0
# via
# tox
# virtualenv
ghp-import==2.1.0
# via mkdocs
greenlet==1.1.2
greenlet==1.1.3
# via
# -r requirements/prod.txt
# sqlalchemy
gvgen==1.0
# via -r requirements/prod.txt
identify==2.5.0
identify==2.5.5
# via pre-commit
idna==3.3
idna==3.4
# via
# -r requirements/prod.txt
# requests
# yarl
importlib-metadata==4.11.3
importlib-metadata==4.12.0
# via
# markdown
# mkdocs
importlib-resources==5.7.1
importlib-resources==5.9.0
# via tox-gh-actions
iniconfig==1.1.1
# via pytest
jinja2==2.11.3
# via
# -r requirements/prod.txt
# diff-cover
# mkdocs
jsonschema==4.5.1
jsonschema==4.16.0
# via -r requirements/dev.in
markdown==3.3.7
markdown==3.4.1
# via mkdocs
markupsafe==2.0.1
# via
Expand All @@ -93,36 +98,39 @@ multidict==6.0.2
# via yarl
mypy-extensions==0.4.3
# via black
nodeenv==1.6.0
nodeenv==1.7.0
# via pre-commit
packaging==21.3
# via
# mkdocs
# pytest
# tox
pathspec==0.9.0
pathspec==0.10.1
# via black
platformdirs==2.5.2
# via
# black
# virtualenv
pluggy==1.0.0
# via
# diff-cover
# pytest
# tox
pre-commit==2.19.0
pre-commit==2.20.0
# via -r requirements/dev.in
py==1.11.0
# via
# pytest
# tox
pydantic==1.9.0
pydantic==1.10.2
# via -r requirements/prod.txt
pygments==2.13.0
# via diff-cover
pyparsing==3.0.9
# via packaging
pyrsistent==0.18.1
# via jsonschema
pytest==7.1.2
pytest==7.1.3
# via
# -r requirements/dev.in
# pytest-cov
Expand All @@ -147,64 +155,66 @@ pyyaml==6.0
# vcrpy
pyyaml-env-tag==0.1
# via mkdocs
requests==2.27.1
requests==2.28.1
# via
# -r requirements/prod.txt
# coveralls
# responses
responses==0.20.0
responses==0.21.0
# via -r requirements/dev.in
six==1.16.0
# via
# -r requirements/prod.txt
# python-dateutil
# tox
# vcrpy
# virtualenv
sqlalchemy==1.4.36
sqlalchemy==1.4.41
# via -r requirements/prod.txt
toml==0.10.2
# via
# pre-commit
# tox
# via pre-commit
tomli==2.0.1
# via
# black
# coverage
# pytest
tox==3.25.0
# tox
tox==3.26.0
# via
# -r requirements/dev.in
# tox-gh-actions
tox-gh-actions==2.9.1
# via -r requirements/dev.in
typeguard==2.10.0
# via -r requirements/dev.in
typing-extensions==4.2.0
typing-extensions==4.3.0
# via
# -r requirements/prod.txt
# black
# pydantic
urllib3==1.26.9
urllib3==1.26.12
# via
# -r requirements/prod.txt
# requests
# responses
vcrpy==4.1.1
vcrpy==4.2.1
# via
# -r requirements/dev.in
# pytest-vcr
virtualenv==20.14.1
virtualenv==20.16.5
# via
# pre-commit
# tox
watchdog==2.1.7
watchdog==2.1.9
# via mkdocs
wrapt==1.14.1
# via vcrpy
yarl==1.7.2
yarl==1.8.1
# via vcrpy
zipp==3.8.0
zipp==3.8.1
# via
# importlib-metadata
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
setuptools==65.3.0
# via nodeenv
20 changes: 10 additions & 10 deletions requirements/prod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
#
# pip-compile --allow-unsafe requirements/prod.in
#
certifi==2021.10.8
certifi==2022.9.14
# via requests
charset-normalizer==2.0.12
charset-normalizer==2.1.1
# via requests
click==8.1.3
# via -r requirements/prod.in
faker==12.3.3
faker==14.2.0
# via -r requirements/prod.in
greenlet==1.1.2
greenlet==1.1.3
# via sqlalchemy
gvgen==1.0
# via -r requirements/prod.in
idna==3.3
idna==3.4
# via requests
jinja2==2.11.3
# via -r requirements/prod.in
markupsafe==2.0.1
# via
# -r requirements/prod.in
# jinja2
pydantic==1.9.0
pydantic==1.10.2
# via -r requirements/prod.in
python-baseconv==1.2.2
# via -r requirements/prod.in
Expand All @@ -34,13 +34,13 @@ python-dateutil==2.8.2
# faker
pyyaml==6.0
# via -r requirements/prod.in
requests==2.27.1
requests==2.28.1
# via -r requirements/prod.in
six==1.16.0
# via python-dateutil
sqlalchemy==1.4.36
sqlalchemy==1.4.41
# via -r requirements/prod.in
typing-extensions==4.2.0
typing-extensions==4.3.0
# via pydantic
urllib3==1.26.9
urllib3==1.26.12
# via requests

0 comments on commit 7b03b3e

Please sign in to comment.