This repository was archived by the owner on Apr 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 465
improve Conda environment discovery and logging #3775
Merged
jonsequitur
merged 1 commit into
dotnet:main
from
jonsequitur:jupyter-subkernel-code-cleanup-and-logging
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
14 changes: 14 additions & 0 deletions
14
src/Microsoft.DotNet.Interactive.Jupyter.Tests/IMessageTracker.cs
This file contains hidden or 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,14 @@ | ||
| // Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| using System; | ||
| using Microsoft.DotNet.Interactive.Jupyter.Messaging; | ||
|
|
||
| namespace Microsoft.DotNet.Interactive.Jupyter.Tests; | ||
|
|
||
| public interface IMessageTracker : IMessageSender, IMessageReceiver, IDisposable | ||
| { | ||
| public void Attach(IMessageSender sender, IMessageReceiver receiver); | ||
| public IObservable<Message> SentMessages { get; } | ||
| public IObservable<Message> ReceivedMessages { get; } | ||
| } |
58 changes: 58 additions & 0 deletions
58
src/Microsoft.DotNet.Interactive.Jupyter.Tests/JupyterHttpTestDataAttribute.cs
This file contains hidden or 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,58 @@ | ||
| // Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| using System; | ||
|
|
||
| namespace Microsoft.DotNet.Interactive.Jupyter.Tests; | ||
|
|
||
| internal sealed class JupyterHttpTestDataAttribute : JupyterTestDataAttribute | ||
| { | ||
| public const string TEST_DOTNET_JUPYTER_HTTP_CONN = nameof(TEST_DOTNET_JUPYTER_HTTP_CONN); | ||
| public const string JUPYTER_HTTP = nameof(JUPYTER_HTTP); | ||
| private static readonly string _skipReason; | ||
|
|
||
| static JupyterHttpTestDataAttribute() | ||
| { | ||
| _skipReason = TestConnectionAndReturnSkipReason(); | ||
| } | ||
|
|
||
| public JupyterHttpTestDataAttribute(params object[] data) : base(data) | ||
| { | ||
| if (_skipReason is not null) | ||
| { | ||
| Skip = _skipReason; | ||
| } | ||
| } | ||
|
|
||
| internal static string TestConnectionAndReturnSkipReason() | ||
| { | ||
| string connectionString = GetConnectionString(); | ||
| if (string.IsNullOrWhiteSpace(connectionString)) | ||
| { | ||
| return $"Environment variable {TEST_DOTNET_JUPYTER_HTTP_CONN} is not set. To run tests that require " | ||
| + "Jupyter server running, this environment variable must be set to a valid connection string value with --url and --token."; | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
| public static string GetConnectionString() | ||
| { | ||
| // e.g. --url <server> --token <token> | ||
| return Environment.GetEnvironmentVariable(TEST_DOTNET_JUPYTER_HTTP_CONN); | ||
| } | ||
|
|
||
| protected override JupyterConnectionTestData GetConnectionTestData() | ||
| { | ||
| return new JupyterConnectionTestData(JUPYTER_HTTP, | ||
| new SimulatedJupyterConnectionOptions(new JupyterHttpKernelConnectionOptions(), KernelSpecName, AllowPlayback), | ||
| GetConnectionString() | ||
| ); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Allows playing back the record of the connection by enabling save to a file | ||
| /// and reading back from it at the point of save. | ||
| /// </summary> | ||
| public bool AllowPlayback { get; set; } | ||
| } |
124 changes: 62 additions & 62 deletions
124
...teractive.Jupyter.Tests/JupyterKernelCommandTests.can_connect_to_and_setup_kernel.ir.json
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious what triggered these changes. From what I can read, it does not seem like there is additional validation/compat tied to these API changes but just wanted to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The renames? A number of
Task-returning methods were not named with theAsyncsuffix. I've also renamed a couple of things for clarity.