Merge branch 'main' of https://github.com/tonybaloney/CSnakes #17
dotnet-publish-main.yml
on: push
publish-github-packages
44s
Annotations
2 errors and 4 warnings
publish-github-packages
Process completed with exit code 1.
|
CSnakes.Tests.PythonStaticGeneratorTests ► FormatClassFromMethods(resourceName: "CSnakes.Tests.python.test_reserved.py"):
src/CSnakes.Tests/PythonStaticGeneratorTests.cs#L42
Failed test found in:
CSnakes.Tests-macos-latest-3.13-net9.0.trx
Error:
Shouldly.ShouldMatchApprovedException : To approve the changes run this command:
cp "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_reserved.received.txt" "/Users/runner/work/CSnakes/CSnakes/src/CSnakes.Tests/PythonStaticGeneratorTests/FormatClassFromMethods.test_reserved.approved.txt"
----------------------------
compiledCode
should match approved with options: Ignoring line endings
"// <auto-generated/>
#nullable enable
using CSnakes.Runtime;
using CSnakes.Runtime.Python;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection.Metadata;
using Microsoft.Extensions.Logging;
[assembly: MetadataUpdateHandler(typeof(Python.Generated.Tests.TestClassExtensions))]
namespace Python.Generated.Tests;
public static class TestClassExtensions
{
private static ITestClass? instance;
private static ReadOnlySpan<byte> HotReloadHash => "044a157faf42d9419e625251933559b3"u8;
public static ITestClass TestClass(this IPythonEnvironment env)
{
if (instance is null)
{
instance = new TestClassInternal(env.Logger);
}
Debug.Assert(!env.IsDisposed());
return instance;
}
public static void UpdateApplication(Type[]? updatedTypes)
{
instance?.ReloadModule();
}
private class TestClassInternal : ITestClass
{
private PyObject module;
private readonly ILogger<IPythonEnvironment> logger;
private PyObject __func_switch;
internal TestClassInternal(ILogger<IPythonEnvironment> logger)
{
this.logger = logger;
using (GIL.Acquire())
{
logger.LogDebug("Importing module {ModuleName}", "test");
module = Import.ImportModule("test");
this.__func_switch = module.GetAttr("switch");
}
}
void IReloadableModuleImport.ReloadModule()
{
logger.LogDebug("Reloading module {ModuleName}", "test");
using (GIL.Acquire())
{
Import.ReloadModule(ref module);
// Dispose old functions
this.__func_switch.Dispose();
// Bind to new functions
this.__func_switch = module.GetAttr("switch");
}
}
public void Dispose()
{
logger.LogDebug("Disposing module {ModuleName}", "test");
this.__func_switch.Dispose();
module.Dispose();
}
public void Switch(bool @new)
{
using (GIL.Acquire())
{
logger.LogDebug("Invoking Python function: {FunctionName}", "switch");
PyObject __underlyingPythonFunc = this.__func_switch;
using PyObject @new_pyObject = PyObject.From(@new)!;
using PyObject __result_pyObject = __underlyingPythonFunc.Call(@new_pyObject);
return;
}
}
}
}
/// <summary>
/// Represents functions of the Python module <c>test</c>.
/// </summary>
public interface ITestClass : IReloadableModuleImport
{
/// <summary>
/// Invokes the Python function <c>switch</c>:
/// <code><![CDATA[
/// def switch(new: bool) -> None: ...
/// ]]></code>
/// </summary>
void Switch(bool @new);
}
"
but was
""
difference
Showing some of the 2934 differences
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
Expected Value | / / \s < a u t o - g e n e r a t e d / > \n ...
Actual Value | ...
Expected Code | 47 47 32 60 97 117 116 111 45 103 101 110 101 114 97 116 101 100 47 62 10 ...
Actual Code | ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 ...
Expected Value | ... # n u l l a b l e \s e n a b l e \n \n u s i ...
Actual Value | ... ...
Expected Code | ... 35 110 117 108 108 97 98 108 101 32 101 110 97 98 108 101 10 10 117 115 105 ...
Actual Code | ... ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 ...
Expected Value | ... n g \s C S n a k e s . R u n t i m e ; \n u ...
Actual Value | ... ...
Expected Code | ... 110 103 32 67 83 110 97 107 101 115 46 82 117 110 116 105 109 101 59 10 117 ...
Actual Code | ... ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 ...
Expected Value | ... s i n g \s C S n a k e s . R u n t i m e . ...
Actual Value | ... ...
Expected Code | ... 115 105 110 103 32 67 83 110 97 107 101 115 46 82 117 110 116 105 109 101 46 ...
Actual Code | ... ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 ...
Expected Value | ... P y t h o n ; \n \n u s i n g \s S y s t e m ...
Actual Value | ... ...
Expected Code | ... 80 121 116 104 111 110 59 10 10 117 115 105 110 103 32 83 121 115 116 101 109 ...
Actual Code | ... ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 ...
Expected Value | ... ; \n u s i n g \s S y s t e m . C o l l e c ...
Actual Value | ... ...
Expected Code | ... 59 10 117 115 105 110 103 32 83 121 115 116 101 109 46 67 111 108 108 101 99 ...
Actual Code | ... ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 ...
Expected Value | ... t i o n s . G e n e r i c ; \n u s i n g \s ...
Actual Value | ... ...
Expected Code | ... 116 105 111 110 115 46 71 101 110 101 114 105 99 59 10 117 115 105 110 103 32 ...
Actual Code | ... ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 ...
Expected Value | ... S y s t e m . D i a g n o s t i c s ; \n u ...
Actual Value | ... ...
Expected Code | ... 83 121 115 116 101 109 46 68 105 97 103 110 111 115 116 105 99 115 59 10 117 ...
Actual Code | ... ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 ...
Expected Value | ... s i n g \s S y s t e m . R e f l e c t i o ...
Actual Value | ... ...
Expected Code | ... 115 105 110 103 32 83 121 115 116 101 109 46 82 101 102 108 101 99 116 105 111 ...
Actual Code | ... ...
Difference | | | | | | | | | | | | | | | | | | | | | |
| \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/ \|/
Index | ... 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 ...
Expected Value | ... n . M e t a d a t a ; \n \n u s i n g \s M i ...
Actual Value | ... ...
Expected Code | ... 110 46 77 101 116 97 100 97 116 97 59 10 10 117 115 105 110 103 32 77 105 ...
Actual Code | ... ...
|
publish-github-packages:
src/CSnakes.Runtime/PackageManagement/PipInstaller.cs#L46
Argument of type 'IReadOnlyDictionary<string, string>' cannot be used for parameter 'extraEnv' of type 'IReadOnlyDictionary<string, string?>' in 'void ProcessUtils.ExecuteProcess(string fileName, string arguments, string workingDirectory, string path, ILogger logger, IReadOnlyDictionary<string, string?>? extraEnv = null)' due to differences in the nullability of reference types.
|
publish-github-packages:
src/CSnakes.Runtime/PackageManagement/PipInstaller.cs#L46
Argument of type 'IReadOnlyDictionary<string, string>' cannot be used for parameter 'extraEnv' of type 'IReadOnlyDictionary<string, string?>' in 'void ProcessUtils.ExecuteProcess(string fileName, string arguments, string workingDirectory, string path, ILogger logger, IReadOnlyDictionary<string, string?>? extraEnv = null)' due to differences in the nullability of reference types.
|
publish-github-packages:
src/CSnakes.Runtime/PackageManagement/PipInstaller.cs#L46
Argument of type 'IReadOnlyDictionary<string, string>' cannot be used for parameter 'extraEnv' of type 'IReadOnlyDictionary<string, string?>' in 'void ProcessUtils.ExecuteProcess(string fileName, string arguments, string workingDirectory, string path, ILogger logger, IReadOnlyDictionary<string, string?>? extraEnv = null)' due to differences in the nullability of reference types.
|
publish-github-packages:
src/CSnakes.Runtime/PackageManagement/PipInstaller.cs#L46
Argument of type 'IReadOnlyDictionary<string, string>' cannot be used for parameter 'extraEnv' of type 'IReadOnlyDictionary<string, string?>' in 'void ProcessUtils.ExecuteProcess(string fileName, string arguments, string workingDirectory, string path, ILogger logger, IReadOnlyDictionary<string, string?>? extraEnv = null)' due to differences in the nullability of reference types.
|
Artifacts
Produced during runtime
Name | Size | |
---|---|---|
nuget-packages
|
355 KB |
|