-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into m-kovalsky/functionparametersdescriptions
- Loading branch information
Showing
51 changed files
with
141 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Semantic Link Labs | ||
|
||
on: [push] | ||
|
||
permissions: | ||
contents: write # This is required for actions/checkout@v1 | ||
security-events: write # To upload sarif files | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: python | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
|
||
- name: Get Date | ||
id: get-date | ||
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | ||
shell: bash | ||
|
||
- name: Cache conda | ||
uses: actions/cache@v2 | ||
env: | ||
# Increase this value to reset cache if environment.yml has not changed | ||
CACHE_NUMBER: 0 | ||
with: | ||
path: ~/conda_pkgs_dir | ||
key: | ||
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ steps.get-date.outputs.today }}-${{ hashFiles('environment.yml') }} | ||
|
||
- uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
auto-update-conda: true | ||
activate-environment: fabric | ||
python-version: "3.10" | ||
environment-file: environment.yml | ||
channel-priority: strict | ||
|
||
- name: Install package | ||
shell: bash -el {0} | ||
run: | | ||
conda info | ||
pip install -e . | ||
# - name: Lint with flake8 | ||
# shell: bash -el {0} | ||
# run: | | ||
# flake8 sempy_labs tests --count --show-source --statistics | ||
# continue-on-error: false | ||
|
||
# - name: Lint with mypy | ||
# shell: bash -el {0} | ||
# run: | | ||
# mypy sempy_labs tests | ||
# continue-on-error: false | ||
|
||
- name: Test with pytest | ||
shell: bash -el {0} | ||
run: | | ||
pytest -s tests/ |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: fabric | ||
dependencies: | ||
- flake8 | ||
- mypy | ||
- pytest | ||
- pytest-cov | ||
- pytest-mock | ||
- pip: | ||
- semantic-link-sempy>=0.7.5 | ||
- azure-identity==1.7.1 | ||
- azure-storage-blob>=12.9.0 | ||
- pandas-stubs |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import pandas as pd | ||
from json import loads | ||
from sempy_labs.shortcuts import create_shortcut_onelake | ||
from unittest.mock import MagicMock, PropertyMock, patch | ||
|
||
|
||
@patch("sempy.fabric.list_items") | ||
@patch("sempy.fabric.resolve_workspace_id") | ||
@patch("sempy.fabric.FabricRestClient") | ||
def test_create_shortcut_onelake(fabric_rest_client_mock, resolve_workspace_id_mock, list_items_mock): | ||
# prepare mocks | ||
def resolve_workspace_id_mock_side_effect(workspace_name): | ||
if workspace_name == "source_workspace": | ||
return "00000000-0000-0000-0000-000000000001" | ||
|
||
if workspace_name == "destination_workspace": | ||
return "00000000-0000-0000-0000-000000000002" | ||
|
||
assert False, f"Unexpected workspace: {workspace_name}" | ||
|
||
resolve_workspace_id_mock.side_effect = resolve_workspace_id_mock_side_effect | ||
|
||
def list_items_side_effect(type, workspace): | ||
assert type == "Lakehouse" | ||
|
||
if workspace == "source_workspace": | ||
return pd.DataFrame([{ | ||
"Display Name": "source_lakehouse", | ||
"Id": "10000000-0000-0000-0000-000000000001" | ||
}]) | ||
|
||
if workspace == "destination_workspace": | ||
return pd.DataFrame([{ | ||
"Display Name": "destination_lakehouse", | ||
"Id": "20000000-0000-0000-0000-000000000002" | ||
}]) | ||
|
||
assert False, f"Unexpected workspace: {workspace}" | ||
|
||
list_items_mock.side_effect = list_items_side_effect | ||
|
||
def post_side_effect(url, json): | ||
# TODO: we could validate the URL and JSON? | ||
|
||
response = MagicMock() | ||
type(response).status_code = PropertyMock(return_value=201) | ||
|
||
return response | ||
|
||
fabric_rest_client_mock.return_value.post.side_effect = post_side_effect | ||
|
||
# execute | ||
create_shortcut_onelake("table_name", "source_lakehouse", "source_workspace", "destination_lakehouse", "destination_workspace", "shortcut_name") |